Ctrl K

When the Late Train Arrives

Easy
A train is scheduled to arrive at exactly scheduled o'clock, but it is running delay hours late. The station clock is 24-hour: after 23 comes 0. Return the hour at which the train actually arrives (a number from 0 to 23).
Example 1
scheduled=9, delay=4 → 13

Four hours late, the train arrives at 13:00.

Example 2
scheduled=22, delay=5 → 3

22 + 5 = 27 hours, which is 3:00 the next day.

Example 3
scheduled=18, delay=6 → 0
Constraints
  • 1 ≤ scheduled < 24
  • 1 ≤ delay ≤ 24
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsA Number That Reads Both Ways EasyValue of a Roman Numeral EasyAdd One to a Digit Array EasySum of Binary Strings EasyWhole Square Root Easy
loading Python…
Input
scheduled=9, delay=4
Expected
13

Run checks the first 3 tests in your browser. Submit checks all 33 tests on the server, hidden ones included.