Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Finish the solution so that it returns the sum of all the multiples of 3 or 5 below the number passed in.

    Below the number, 10 is the number, so 10 can't be one of those multiples.

  • Custom User Avatar

    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. ✌

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    You need to return your result.

  • Custom User Avatar

    Because:

    If there is enough space, return 0, and if there isn't, return the number of passengers he can't take.

    With a capacity of 20 and 5 passengers on board, there is plenty space for the 5 new passengers.

  • Custom User Avatar

    Because handicap isn't greater than 7.