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.
An O(N^2) time complexity algorithm will timeout, opt for an O(N) time complexity algorithm.
We can forget about 1-5 and 16-19 because they are inside 1-6 an 10-20. 1-6 and 5-11 = 1-11. And 1-11 and 10-20 = 1-20. It's length = 20-1 = 19;
This comment is hidden because it contains spoiler information about the solution
You're right, everything overlaps, so you end with a unique interval
[1, 20]
, which length is19
.But you already used number 10 in the previous intervals (so, only 9 for those)
This comment is hidden because it contains spoiler information about the solution
The representation of a number as floating point or strings is exactly that: a representation. A string can exactly represent the input and output, so that's what's used. What you want to do with them is up to you.
You should add the numbers. That's it.
There's no ambiguity in the input or output. How you would implement it is your task.
This comment is hidden because it contains spoiler information about the solution