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.
Also,
findIndex
is NOT the correct solution for the problem in the description.You're still solving the wrong problem.
Not a kata issue. Closing.
You can see the example tests. They're in the box under your solution, marked "Sample Tests". If you don't know which test you are failing, comment out all but one test at a time.
Yes, you are returning
Just 0
.Just 9
comes from that index. Any index that points to-4
would have been correct.You are not returning "the least index of a number larger than the element at the given index," are you?
ETA: I have added an Example test for everybody who is doing this wrong ( you may have to refresh .. ). The existing tests did not fail on this. I now have added this to all languages.
ETA: Looks like you are. Also, it's called findIndex.
The
Just 1
you got in your own environment is the output from a function that delivers wrong results, so I cannot interpret that.I have updated the random tests to give an error message including the value solver returned ( you may have to refresh something(s) to see that ).
Keep in mind that multiple answers may be correct, so I can't test against a reference solution, I have to test that THE returned index points to A correct value in the array. Which is what is being tested.
Just 3
is the value at your returned index.Just (-1)
is the value at any correct index.Does this answer your questions?
Yep, if anyone else is stumped just reading the unit tests remember that the arrays are columns going down from left to right, for example:
The following mine:
mine = [[1,2,3], [4,5,6],[7,8,9]]
would not look likebut rather like:
This makes the right/left/up/down directions easier to visualise although it doesn't really affect the problem.