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.
A note for those who failed at the random testcases: make sure you are not using any global variable, as those test cases are actually 5 sub-testcases randomly generated in a for loop, so any global var you're using will not be reset after each test like the sample cases.
This comment is hidden because it contains spoiler information about the solution
Same issue. @BattleRattle can you take a look into this please ?
The first line of the description should be
var namedOne = new OnceNamedOne("Naomi","Wang")
to be consistent with the rest
1/ For some katas regarding design patterns, it would help if there is some hint (e.g read through closure, function currying, observer pattern before starting...) so that novices doesn't feel lost
2/ It's good if there is some kind of personal notebook so that users can document ideas that they find interesting, e.g some new kata idea that pop up while solving another kata, or simply notes about how a solution can be improved next time.
Never mind, I got the question wrong. Resolved it.
Note that the question is asking for removal of the longest PREFIX, so any sub-array that satisfy but is not prefix should not be removed.
I've tried many times but still having 2 tests failed:
the dropWhile function
should be defined
Test Passed: Value == []
should work when testing for even numbers
Test Passed: Value == []
Test Passed: Value == [1,5,4,3]
Expected: [1,4,2,3,5,4,5,6,7], instead got: [1,3,5,4,5,6,7]
Test Passed: Value == [5,3,4,6]
Test Passed: Value == [1,1,1]
should work when testing for odd numbers
Test Passed: Value == []
Expected: [2,1,2,4,3,5,4,6,7,8,9,0], instead got: [2,1,2,4,4,6,7,8,9,0]
Test Passed: Value == [2,4,6,4,5]
Test Passed: Value == [86,902,2,1]
I didn't modify the original array btw. Anyone got same problem ?
Besides, if two sequences satisfy the predicate and have same length, which one should be removed ?
Got it! Thanks!
I run using the provided test suite got this result:
The Span Function
should be defined
Test Passed: Value == [[],[]]
should work when testing for even numbers
Test Passed: Value == [[2,4,6],[1,4,8]]
should work when the first element results in false
Test Passed: Value == [[],[1,4,5,7,6]]
should work when no element results in false
Expected: [[],[]], instead got: [[13,17,19,11,21],[]]
The third test case comparison seems wrong, since it actually expects [[13,17,19,11,21],[]]
FYI, this is the third test case:
var arr3 = [13,17,19,11,21];
it("should work when no element results in false", function () {
Test.assertSimilar(span(arr3, isOdd), [arr3,[]]);
});
When I submit, my code also failed at the same test case ("should work when no element results in false")
Please take a look, thanks :)