Ad
  • Custom User Avatar

    Definitely a nice kata. Praise debuggers for existing

  • Custom User Avatar

    Rounding issues should be fixed with this kata. The user is not provided feedback on the training set used in testing. It should show expected as well as user answer, now only showing expected

    Expected costFunctionJ(trainingSet2, 1, 1.1) to equal 10.028

    Anyone stumbling upon the same problem: use Math.round(J * 1000) / 1000 for rounding to 3 decimals, not toFixed(3)

  • Custom User Avatar
  • Custom User Avatar

    Oh I see, got ya. Was overthinking it.

  • Custom User Avatar

    You misunderstood the requirement, [6, 2] is the correct answer. That's because parsing from the left pair of [6, 2] is formed earlier than [3, 5]. It's not about index difference.

  • Custom User Avatar

    Bugged. Does not check for the last requirement, which checks which pair comes first.
    For instance in myList = [1,4,6,0,2,7,8,3,5] Should return 3,5 instead of 6,2 for target 8, yet with a lot of peoples' code and my code it returns 6,2 which is regarded as correct. Just putting it out there because I spent significant time trying to figure out how to check for index distances between pairs whilst it wasn't needed.

  • Custom User Avatar

    Don't mention it, we are all here to learn :)

    [Like me, trying to be more precise with English: above it should have been "no number satisfies", ah!]

  • Custom User Avatar

    Thanks for your reply, adjusted my code a little after thinking it through a bit and got it right this time. Sorry again for the dumb question.

  • Custom User Avatar

    You return 2 arrays for no reason; plus when no number satisfy the condition, you should just return [0,0,0].

  • Custom User Avatar

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