Ad
  • Default User Avatar

    I see it too

  • Custom User Avatar
  • Custom User Avatar

    Whoops, my bad, I put one of my statement in the wrong order in my code.

  • Custom User Avatar
    1. Sum all the digits (for 10 this is 1)
    2. Substract the sum from n (this is 10-1)
    3. If the new n (10-1) is in the list: return else goto 1.
  • Custom User Avatar

    Sum all the digits... You haven't done that. Not a kata issue.

  • Custom User Avatar

    Java
    I having problems in the fruit list aryan-firouzian.

    Sample test
    public class SolutionTest {
    @Test
    public void basicTest() {
    assertEquals("apple", Kata.subtractSum(10));
    }
    }

    Fruit list from instructions
    1-kiwi
    2-pear
    3-kiwi
    4-banana
    5-melon
    6-banana
    7-melon
    8-pineapple
    9-apple
    10-pineapple
    11-cucumber
    ...
    Apple is at 9. Yet test is expecting at 10.

    I think your fruit list in instruction is incorrect because I am getting mixed results(1 correct 1 wrong for random numbers) whenever clicking 'Attempt'.

  • Custom User Avatar

    Dectector

    Palindromization - Java 1.8.0_91(Java 8)
    I have problem with the exercise. When I run the sample test without modifying the code I get following error message.
    STDERR:
    /workspace/java/src/KataTests.java:28: error: class, interface, or enum expected
    }
    ^
    1 error

    I noticed that there is addition closing curly brace (}) with no opening brace.

    Default code

    public class Kata {
    public static String palindromization(String elements, int n) {
    return elements;
    }
    }

    Sample Test

    import org.junit.Test;
    import static org.junit.Assert.assertEquals;
    import org.junit.runners.JUnit4;
    public class KataTests {
    @Test
    public void Error_Cases() {

        assertEquals(Kata.palindromization("", 2), "Error!");
        assertEquals(Kata.palindromization("123", 1), "Error!");
    
    }
    
    @Test
    public void Examples() {
        
        assertEquals(Kata.palindromization("123", 2), "11");
        assertEquals(Kata.palindromization("123", 3), "121");
        assertEquals(Kata.palindromization("123", 4), "1221");
        assertEquals(Kata.palindromization("123", 5), "12321");
        assertEquals(Kata.palindromization("123", 6), "123321");
        assertEquals(Kata.palindromization("123", 7), "1231321");
        assertEquals(Kata.palindromization("123", 8), "12311321");
        assertEquals(Kata.palindromization("123", 9), "123121321");
        assertEquals(Kata.palindromization("123", 10), "1231221321");
        
    }
    

    } // No opening curly brace
    }

  • Custom User Avatar

    Thanks for clarifying that. My code is not checking for that, I need to go and fix it.

  • Default User Avatar

    Yes, that is correct.

  • Custom User Avatar

    Thanks for gettin back to me joh_pot. Can I clarify something regard the instructions.
    The function should only return 1 only if the first number contains straight triple and second number contain straight double of the same value digit
    E.g.
    (451999277, 41177722899) == 1 (num1 -triple 999s and num2 -double 99s)
    (451999277L, 411777228L) == 0 (no double 99s in num2)

  • Default User Avatar

    Hi KKOA

    Thanks for replying! I have noticed this on some of my other katas too. Some users will see different tests to what other users will see. I'm not sure if certain users are getting served by another server with a stale cached copy or what's going on. I can guarantee you that what I see when I go to "Edit Kata" is that specific test I pasted up top. I'm sorry but there's nothing I can do about it. For now, just change TripleDouble in the Example Tests to Kata.TripleDouble.

  • Custom User Avatar

    Hi joh_pot
    The method arguments on test5 were different from yours for me. Originally it was this
    assertEquals(0, TripleDouble(451999277L, 411777228L));

    This was cause compile error because it was not call the static method correctly.

    I have reset challenge and I am still not getting your method arguments. Below are the sample tests provide to me

    import org.junit.Test;
    import static org.junit.Assert.assertEquals;

    public class Tests {

    @Test
    public void test1(){
      assertEquals(1, Kata.TripleDouble(451999277L, 41177722899L));
    }
    
    @Test
    public void test2(){
      assertEquals(0, Kata.TripleDouble(1222345L, 12345L));    
    }
    
    @Test
    public void test3(){
      assertEquals(0, Kata.TripleDouble(12345L, 12345L));
    }
    
    @Test
    public void test4(){
      assertEquals(1, Kata.TripleDouble(666789L, 12345667L));
    }
    
    @Test
    public void test5() {
      assertEquals(0, TripleDouble(451999277L, 411777228L));
    }
    

    }

    This is for java 1.8.0_91(Java 8).

  • Default User Avatar

    No response. Closing issue.

  • Default User Avatar

    Hi KKOA

    Can you please provide more information on the issue that you are experiencing? For test5 this is what I can see in the example tests:

    @Test
    public void test5(){
      assertEquals(1, Kata.TripleDouble(10560002L, 100L));
    }
    
  • Custom User Avatar

    Java
    test5 from sampleTest is incorrect. The static method is being called incorrectly and the expected result is wrong.
    Should be correct to the below
    @Test
    public void test5() {
    assertEquals(1, Kata.TripleDouble(451999277L, 411777228L));
    }
    otherwise test will always fail due compile-time error.
    Joh_pot, you need to fix.