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.
Although you can easily index an array with
-1, 0, 1
too...I think main idea of this kata is write own method like .permutation.
First, <=> operator returns -1, 0, or 1.
i.e.)
scores[:P2] <=> scores[:P1]
returns-1 if scores[:P2] < scores[:P1]
0 if scores[:P2] == scores[:P1]
1 if scores[:P2] > scores[:P1]
Because array index starts from 0, adding 1 is necessary to make a correct index (0, 1, or 2).
cant use method permutation?. Works perfect when tested locally.
why the + 1 at the end?
I know this solution is as simple as it gets. HOWEVER, can anybody dare explaining it ?.
You don't need matrices.
I used Matrix class. Of course, since the test suite must have some insanely large integers, my code can't be submitted, but it works with small numbers.
The output example is wrong. int 52 can never be "Penny", even if you count it manually the right value is "Leonard".
Can't pass test suite but passes all tests locally. Also, some of the the int parameters might be just too large to being handled as a number. The test suite times out.