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.
As long as the given input is not a string or any characters within it are not digits, you should raise an Exception. Currently, you are only checking whether the string is a single-spaced character and any of the characters in it is
NaN
, which is not feasible because strings can only store characters.I guess this is resolved.
This comment is hidden because it contains spoiler information about the solution
Op solved, closing.
Your code fails on one test only because tests are probably insufficient in your language...
Hint: is your last statement really ok?
5-1=4
It's
[1,2,3,4]
- the second value is exclusive.This makes it exceedingly easy to calculate the length of the interval - one would have thought you'd be pleased.
Print the input, check your answer against Wolframalpha