Ad
  • Default User Avatar

    Well, I copy pasted the code and tried it for 25, 25, 50, 100 where it should return "YES" since for 50 we are returning 25 and for 100 we are returning 50 + 25.

    But this code return NO, becuase the iterations are as following:

    ticket | given | sum
    25 | 0 | 25
    25 | 0 | 50
    50 | 25 | 50
    100 | 75 | 0 (sum < given) = NO

  • Default User Avatar

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