A space station tracks docking attempts using a 24-hour clock that only ever displays a value from 0 to 23, where 0 represents the start of the day. A docking attempt is originally scheduled for a given hour, but an orbital adjustment pushes it back by some number of hours. Because the clock wraps around every 24 hours, determine which hour the clock will actually show when the delayed docking begins.
A single line containing two space-separated integers: scheduledHour and delayHours.
A single line containing one integer: the hour (0 to 23) the station's clock shows after applying the delay.
Example 1
Input
14 15
Expected
5
Explanation
14 + 15 = 29 hours. Since the clock wraps every 24 hours, 29 mod 24 = 5, so the clock shows hour 5.
Example 2
Input
23 1
Expected
0
Explanation
23 + 1 = 24 hours, which is exactly one full wrap of the clock, so 24 mod 24 = 0 and the clock shows hour 0.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →