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.
the kata needs clarification but I think if it meant to return "bye" and not "e" then it should also return "hi" if "hi" is the only argument. otherwise it's inconsistent. what if the arguments were
("hello", [1, "world", [2, 3]])
? Should it return[1, "world", [2, 3]]
,[2, 3]
, or3
?A zero-liner, anyone?
Modified, thanks!
Have you tried again? I changed the tests.
"Sample tests" in Ruby still have the same problem
Broken how exactly? I passed the kata without problems.
P.S.: I see there are already open issues about that below.
The tests only use a precision of 1e-6 when comparing the results
In all translations results were and are tested with a tolerance of 1.0e-6...
I remove the "you can truncate..." which was a remnant of the first kata.
Sorry: the "Sample tests" have not been updated.
Mpdified. Thanks!
beggars([1,2,3],0) -> [NaN: NaN]. Does not work, should return []. Current tests are testing for n=0 too
Same
No, it does, because Array(0) create empty array and the cycle doesn't begin
;) Take a look at my one-liner.
it's
O(n*log(k))
, iirc.n
the length of the argument andk
the number of elements you keep. Comparing to the other approach, it makes itO(n)
, k being constant. But the overhead of the constant term is far from small (especially because that tool is built in pyhton code, not like the sort functions that are in Cython), so you'll see the effect if k is small enough, and the list long enough.This comment is hidden because it contains spoiler information about the solution
Loading more items...