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.
Yes, apologies.
should be
533
This comment is hidden because it contains spoiler information about the solution
One of the best kata I've done!
Nice!
Solved it! My original idea did carry through.
I added an assertion on
expected length
right beforedeep equality
check. This takes away much of the performance issues on incorrect solutions, including[[1]]
.It checks against a reference solution. These arrays can get huge. Deep equality checks can be slow, and the reference solution also takes time to execute. Why it takes so much time on an empty array, did surprise me too! It's a Chai implementation artifact though. Let me check if I can bypass deep equality checks if length of nested tuples does not match.
May I know why this is the case? Why does the checker take so long to fail short arrays (by default)? This is no longer an issue, but it still can't fail
[[1]]
in time.timeout issue fixed on empty array
It only times out on slow solutions and the empty array. Correct solutions still pass fast. I'll improve test feedback to immediately fail on empty arrays.
The program consistently times out even if the function always returns an empty array.
The "dictionary" and the "adjacency list" are quite similar in structure, and one of them should be taken out as a redundant test case. The kata should be testing the conversion of "edge list" instead of "adjacency list".
yes
In most languages, subtraction comes before shifting. Could this be phrased as
abs((n >> 1) - k) ≤ 4
?Loading more items...