Ad
  • Custom User Avatar

    The tests that are run when you click Run Tests are different than the ones that run when you press Submit.

    Run Tests only runs the tests in the editor below the code editor. Submit will run more thorough tests written by the author of the kata.

    If you aren't sure what's causing your solution to fail the tests, try outputting the two input parameters to the console.

  • Custom User Avatar

    I agree with g964 - (and I didn't realize this), but if you output the two input parameters to the console, you'll be able to see exactly what values are causing those specific tests to fail.

    Also, I think you have two problems:

    1. I think your part of your first if statement's condition - a[0] != b[0] - is not doing what you want it to do. Remember that this is comparing the first two elements, but the order of the two arrays doesn't matter.
    2. In your for loops, it might be clearer what's happening if you include curly braces {} even if they technically aren't required. Remember that once you return a value, the function stop executing - so maybe reconsider when exactly you can be sure that you can return true.

    I hope that points you in the right direction!

  • Custom User Avatar

    Yeah, this was a bit tricky. This case is described in the directions in one of the examples. Basically, the expected output is the first, smallest pair that equals the sum, not just the first pair you come across (in the example, the "first pair" is defined by the last index of the pair, it seems; in the last example, a pair with indices 1,5 comes after 3,4 because a last index of 5 comes after a last index of 4 - this is why in the REDUX problem the answer needs to have indices 3 and 4).

  • 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

    I think 7 seconds is the max