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.
Your solution is not correct, it works only for number = 1000. What if number is 100? or 42? or 100000?
test
expected:<23> but was:<233168>
Stack Trace
Whats this? i checked my code with answers and ig its correct?
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.
This comment is hidden because it contains spoiler information about the solution
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. ✌
This comment is hidden because it contains spoiler information about the solution
nvm
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
.test.assert_equals(sum_of_intervals([(1, 4), (7, 10), (3, 5)]), 7) 4-1=3, 10-7=3? 5-3=2 3+3+2=8 not 7
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.
This comment is hidden because it contains spoiler information about the solution
You need to return your result.
Help: None should equal 0
This comment is hidden because it contains spoiler information about the solution
Loading more items...