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.
It seems like there's some floating point errors with the random tests:
E.g.
Expected: [0.29836609045702106, 0.18020364669666114, 0.12242481648117452, 0.0942457968269003, 0.08074828321098745, 0.06961875443997158, 0.05541084537058963, 0.053279659010182334, 0.045702107506511956]
instead: [0.298366090457027, 0.18020364669666242, 0.12242481648117365, 0.09424579682689997, 0.08074828321098737, 0.06961875443997172, 0.05541084537058983, 0.053279659010182515, 0.04570210750651206]
The elements of the arrays are accurate to 1-e14, yet tests still fail. I'd avoid comparing two floating point numbers directly.
A quick fix to solve this would be to map the user solution with
.map((v, i) => (v <= expected[i] + 1e-7 && v >= expected[i] - 1e-7) ? expected[i] : v)
. This will change each element to the expected element if it falls within a range of +- 1e-7.This comment is hidden because it contains spoiler information about the solution