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.
I don't remember this kata at all, but I see lots of other similar solutions... I'm not sure how I came up with this.
Can you describe the solution?
I've added random tests.
Neither of these solutions should work, anymore.
Most of the submitted solutions were not actually running most of the tests because Mocha was exiting early. I've added a
Promise.race
wrapper, which will prevent Mocha from exiting early. Most of the submitted solutions are now failing.None of the submitted solutions can unwrap more than one layer of the equivalent of
Promise.resolve
/Promise.reject
(includingPromise.resolve(Promise.resolve(x))
,Promise.resolve(Promise.reject(x))
andPromise.reject(Promise.resolve(x))
), which clearly means the tests are too weak.Also, there are no actual random tests. The only randomness in the tests is the fixed value used throughout the entire test suite.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Added.
Some of the successful solutions are actually not valid in the case of
c(2)
; they result inc(2) = 3
. We should add a test case forc(2) = 2
.I like it, most of us went with filter, reduce, loops, modulo
Nice solution with all logic in the Person class. I like it.