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.
This comment is hidden because it contains spoiler information about the solution
Challenging it is! I am also surprised that the author, who's famous for golfing, didn't make it a
code golf
kata!approved as challenging kyu 7
I would not have thought
Array.length
was slow. ( But I also did not thinkArray.every
was slow. )How about this:
Granted, it would essentially be another kata entirely ("Lookup Table For Paperfold Sequence"), but it would solve the precalculation issue.
This comment is hidden because it contains spoiler information about the solution
wrestled my way through the merge conflicts, if you see any issues with the translation, let me know
I made all the changes, but get the same error as you. My fork is somehow corrupted. EDIT: oops, still using absolute margin
I'll make a relative check, merge description and approve.
Good catch. Can you switch it to relative (perhaps with a manual calculation)?
By the way, I tried approving your translation, but Codewars states
Description cannot be approved, recent changes from related record must be merged first.
Aha! In chai it's absolute. Maybe I need to use a different assertion in JS.
Oh, I see. At least in python,
assert_approx_equals
checks whether the answer is close with absolute or relative margin. By using a margin1e-4
, I intended that the user's answer should be within0.01%
of the reference answer.I'm not sure how the equivalent Javascript assertion function works.
Somehow, this is fast fast, significantly faster than my essentially identical example solution.
If anybody understands why, I'd love to know.
( Well done, uttumuttu, well done. )
That discrepancy is fine. I just don't get why the sample tests that expected an integer result did pass solutions that gave an exact floating point answer that was
> 1e-4
diff with the integer result.Loading more items...