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
I feel better about my newbienishneess now!
Why not use a switch statement instead of so many ifs?
This comment is hidden because it contains spoiler information about the solution
It's easy enough to test this. ;-)
The answer is no, it returns
false
, which is incorrect. In fact, my answer fails most cases, except, amazingly, the test cases.You should recommend some new test cases to invalidate answers such as mine.
Good find!
In the case compareVersions(10,9.4) , will this solution return true?
This comment is hidden because it contains spoiler information about the solution
There was a mistake in the tests. Acording with description ("You can use any number of summands positive integers and these can be repeated as often as you like."):
sum(0); // 0 <- There is no way to achieve this result with positive numbers.
sum(-1); // 0
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution