Ad
  • Custom User Avatar

    Your solution has a bug and works incorrectly for some inputs, depending on order of intervals. See these intervals which should sum up to 19:

    [(1, 6), (1, 5), (10, 20), (16, 19), (5, 11)] - your result is 20
    [(1, 5), (1, 6), (10, 20), (16, 19), (5, 11)] - your result is 19
    

    The strange behavior of tests you see is because in this challenge, for some reason, tests always shuffle inputs before calling your function. This is why your solution sometimes passed, and sometimes fails: because tests sometimes generate inputs which trigger the bug in your solution, and sometimes not.

  • Custom User Avatar

    I tried to solve it but I am having an undefined behaviour when testing, it always succeeds examples but when trying to attempt large scale test scenarios it sometimes fails the tests it made for the example test scenarios which were successful beforehand.Also when I re-attempt it ,it sometimes fails 3, sometimes 2 and sometimes 1 even though the code is untouched between attempts.