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.
watafak
!!
Use String Builder for the string result = "";
And I thought my code was lengthy
Just found the mistake. My regex didn't match zeros and therefore it did not recognize +10 or -10 movements correctly. Sorry, my bad.
Manually executing those changes lead me to the expected value, not your submitted answer.
Note that your submitted answer is
[ 'l', 'e', 'Q', 'I', 'z', 'f', 'P', 'O', 'm', 'h', 'U', 'w', 'E' ]
and the expected value is[ 'h', 'e', 'Q', 'I', 'z', 'f', 'P', 'O', 'm', 'U', 'l', 'w', 'E' ]
, not the other way around.You might be interpreting
+n
as moving right instead of left, but I have not checked that. Otherwise, I really don't know, but that test is definitely correct.I have already reset, there still to many tests failing
Here is another test result:
expected [ 'l', 'e', 'Q', 'I', 'z', 'f', 'P', 'O', 'm', 'h', 'U', 'w', 'E' ] to deeply equal [ 'h', 'e', 'Q', 'I', 'z', 'f', 'P', 'O', 'm', 'U', 'l', 'w', 'E' ]
leaderboardSort(["l","z","f","e","O","m","P","I","U","h","w","E","Q"], ["Q +3","Q +5","I +2","h +10","f -4","P +1","z -5","f -1","O +1","Q +0","l -10","O -5","l +1"])
There is nothing smaller sorry
Make sure you have the correct tests ( reset ), and can you post a smaller counterexample?
does not work for me. I carefully went through all changes by hand and I know my algo spits out the correct changes to the board. Test this my result is:
assert.deepEqual(leaderboardSort(["ivy","uQV","YiJ","pBO","uhU","RHK","zJx","bhQ","pcj","LbZ","QJv","usq","uZi","KFM"], ["QJv +9","uZi +8","pcj +8","usq +7","pcj -11","usq +3","uQV -3","bhQ +7","uhU +3","LbZ +8","LbZ -10","pcj +3","ivy -9","KFM +9"]), [ 'usq',
'QJv',
'bhQ',
'KFM',
'YiJ',
'uhU',
'uZi',
'pBO',
'uQV',
'pcj',
'ivy',
'RHK',
'zJx',
'LbZ' ]);
Result : [ 'pcj',
'QJv',
'usq',
'bhQ',
'KFM',
'LbZ',
'YiJ',
'uhU',
'uZi',
'uQV',
'pBO',
'ivy',
'RHK',
'zJx' ]
already working, thanks very interesting kata
ok
It is now, but it was ok immediately after approval last time.
Check again tomorrow.
That is not what I was talking about. As you have probably seen already, your code works for smaller leaderboards but not for larger ones. This is due to you not accounting for large changes.
Is it ok now?
Done
Translation approval got lost, apparently. I have forked the translation again, but I cannot approve it myself.
Loading more items...