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.
No probs :)
Right. I was working directly with base array. Now it's ok. Thanks for clarification.
Cannot reproduce the error with my code that always works; my best guess is that your solution somehow modifies the base array, thus giving raise to the problem above.
Edited the code accordingly, but unless otherwise asked, it is always better not to modify your input.
Confirm. Seems like something wrong with random test function for js. Test output:
Can you write the whole sequence step-by-step?
I got the following output when submitting:
Random tests
Testing for base [5, 15, 15] and n 7
It should work for random inputs too: -315 should equal -27795
I don't think the test is working properly. The given inputs should produce -315, which is what my code also produced. What am I doing wrong here?