Ad
  • Custom User Avatar

    Thank you! Hopefully I will learn how zo work withthese tasks...

  • Custom User Avatar

    Don't change the method's signature:

    public class Kata {
        public static int findDeletedNumber(int[] arr, int[] mixedArr) {
            //Your code here
        }
    }
    

    Don't create a main method, I already referred you to the docs about that. Also, the starting array being the numbers from 1 to 9 is an example, your function should take that as the first argument. It can be something different too.

  • Custom User Avatar

    Now I wrote a new code to another kata and on purpose very different from the example, but in the output apparently the methods ofthe example code ar exected. I thought, the challenge is to write an own code for solving the Kata? What do I have to do for solving the Kata? :'(

  • Custom User Avatar

    Oh, you're right. I wasn't seeing the correct logs.

    Sorry.

  • Custom User Avatar

    You would be correct, however I am saying that when I run your code, I don't see this behavior. Are you sure you aren't misreading the logs?

    Here is what I see after running your code a few times:

    arr[]:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
    arr_sz: 14
    mix_arr[]:6, 13, 8, 4, 12, 1, 5, 11, 3, 10, 2, 9, 7, 14, 
    mix_sz: 13
    return base: 0
    Expected: 14
    Received: 0
    
    arr[]:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 
    arr_sz: 10
    mix_arr[]:9, 4, 7, 2, 3, 8, 6, 5, 1, 10, 
    mix_sz: 9
    return base: 0
    Expected: 10
    Received: 0
    
    arr[]:1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 
    arr_sz: 29
    mix_arr[]:21, 7, 8, 23, 17, 26, 1, 2, 6, 5, 14, 3, 12, 22, 18, 9, 25, 16, 24, 27, 11, 15, 10, 19, 4, 28, 13, 20, 29, 
    mix_sz: 28
    return base: 0
    Expected: 29
    Received: 0
    

    You may be mistaking the log above the "returned... received..." part as the log for the failed test, but it's not. Note that when you print the values of arr, your loop prints one value too many (you're printing a value in memory right after the array), which can lead to confusing looking logs.

  • Custom User Avatar

    Sorry. Maybe I didn't understand.
    If arr_sz is 19, the arr object will stop at 19, right? So, the expected output can't be 21, because the number is greater than the arr_sz

    Is it correct?

  • Custom User Avatar

    I could not replicate this with your current code, but there is no mistake. Your current code doesn't check the last number of arr.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Language: C++
    Test suit missing the required header std::list

  • Custom User Avatar

    a little, but too late to make changes

  • Custom User Avatar

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

  • Custom User Avatar
  • Custom User Avatar

    removed 2nd condition

  • Custom User Avatar

    should be fixed after 4 years

  • Loading more items...