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
This solution has the undesirable side effect of emptying the input array. But hey, it's O(n) time and O(n) space complexity.
(a.pop()|0) + (b.pop()|0)
works (same effect as doing~~
)Fails this test:
Test.assertEquals(high('man i need a taxi up to ubud taaxi'), 'taaxi');
Thanks buddy!
I am not going to tell, and I leave it for you to figure out. A couple of hints tho:
n
to console and see what is the lastn
passed to the function before it hangs. Be careful tho, because with how CW works, not all logs can be visible when timeout occurs, and non-flushed output will be lost and left not visible. You might need to force the flush after every write (but you might not, it depends).Good luck!
Glad you figured it out. Always make sure to check how many people completed a given kata in your language. If it's at least 3-digit number, it's almost certain that tests are correct (unless it's some obscure edge case). Happy coding ^_^
Programmer error. My debug wasn't outputting the input value of a call that recurses. I can see the problem now, thanks.
My code passes all other tests including the random ones. Just one test it fails on.
So I had already (before reporting) added a console.log to try and debug so I can see that the input is 43, and yet it fails with
Log:
43, 7 (the output from the console.log(original number, returned sum))
Expected: 9, instead got: 7
I labelled it an issue because it seemed to be an issue in the tests.
The tests are fine. Notice at the top: JavaScript Completions: 27850
I don't see a basic test with 43 for JS. Maybe that's result of one of your logs (if you're using recursion, for example)
Anyway, label
issue
is for actual problems with kata, not for issues with your code :P For that, usequestion
label first.Feel free to reply to get it resolved, but you should start by reading the task again and logging stuff to console to debug your code.
JavaScript: One of the basic tests, 43 asserts the answer should be 9, but the answer should be 7.