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
Below the number, 10 is the number, so 10 can't be one of those multiples.
Since [1,4] overlaps [3,5] take the min and max, which is [1,5] that would give you 4 intervals and you add 3 intervals from [7,10] that would be 7 intervals in total. ✌
You've misunderstood the problem. The intervals (1,4) and (3,5) overlap and the intersection is only counted once; they sum to 4 units as in
(5-3) + (4-1) - (4-3) = 4
, not 5 as in(5-3) + (4-1) = 5
.You should probably test your function and observe how it behaves. There should be example tests that show you some inputs and corresponding expected outputs that you can use for that purpose, and if those are not enough then you are still free to obseserve those things in the full tests by printing.
I marked your comment as spoiler.
You need to return your result.
Because:
With a capacity of 20 and 5 passengers on board, there is plenty space for the 5 new passengers.
Because handicap isn't greater than 7.