Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Definitely a nice kata. Praise debuggers for existing
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
Anyone stumbling upon the same problem: use Math.round(J * 1000) / 1000 for rounding to 3 decimals, not toFixed(3)
Kek
Oh I see, got ya. Was overthinking it.
You misunderstood the requirement,
[6, 2]
is the correct answer. That's becauseparsing from the left
pair of[6, 2]
is formed earlier than[3, 5]
. It's not about index difference.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.
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!]
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.
You return 2 arrays for no reason; plus when no number satisfy the condition, you should just return
[0,0,0]
.This comment is hidden because it contains spoiler information about the solution