Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    I think that n%3 mean that a number divide by 3 and what you want is the remainder. n//3%3 mean that you are diving the number dirst and rounding it down, then you are doinging another division and looking for it's remainder. Same with n//9%3 This just mean that you are dividing by 9 first and rounding down, then you divide by 3 and get the remainder.
    For example;
    5%3 would have a remainder of 2.
    5//3%3 would be 1.66 and round down would have 1, then you find the remainder which is 1.
    12//9%3 would be 1.33 and round down you get 1, then you find the remainder of 1/3 which is 1.

  • Default User Avatar

    I mean how you are calculating the exact hands by dividing. I could think of three nested(one for each person ) for loops that gives me array of numbers, but I was failing to stop the 3 nested at exact hands given as input

  • Custom User Avatar

    In the table given in the kata description, observe that P1, P2, P3 are simply counting in ternary. So this kata is an exercise in converting a decimal integer to ternary.

  • Default User Avatar

    Can you please explain this solution

  • Custom User Avatar
  • Custom User Avatar

    Not a kata issue, and those are several input values together, please read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution

    import static org.junit.Assert.*;
    import java.util.ArrayList;
    import org.junit.Test;
    
    
    public class KataTest {
        @Test
        public void test() {
            assertEquals(3,Kata.findEvenIndex(new int[] {1,2,3,4,3,2,1}));        #1st test
            assertEquals(1,Kata.findEvenIndex(new int[] {1,100,50,-51,1,1}));     #2nd test  
            assertEquals(-1,Kata.findEvenIndex(new int[] {1,2,3,4,5,6}));         #3rd test
            ...
    

    Java Completions 8665

  • Custom User Avatar

    im having issues with hidden test case in java. Anyone getting same? test case is below. It says my code returns 0 running the kata here, but i run my code in my IDE and its returning -1 which the Kata expects.
    1,
    2,
    3,
    4,
    3,
    2,
    1,
    1,
    100,
    50,
    -51,
    1,
    1,
    1,
    2,
    3,
    4,
    5,
    6,
    20,
    10,
    30,
    10,
    10,
    15,
    35,
    -8505,
    -5130,
    1926,
    -9026,
    2824,
    1774,
    -1490,
    -9084,
    -9696,
    23094,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    9,
    8,
    7,
    6,
    5,
    4,
    8,
    8

  • Custom User Avatar

    Posting a solution here is forbidden, if your code is ok, it passes the tests, and you can discuss it in Solutions section. If you have a Question and your code doesn't work, you can post your code here, marking the post as having spoiler content and using markdown formatting. Please read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#post-discourse

  • Default User Avatar

    what do you mean chrono79, i didnt understand. you also shared answer. I posted to check if my understanding is correct or not.

  • Custom User Avatar

    Don't post solutions in kata Discourse.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution