You're managing a railway station's arrival board and need to calculate when delayed trains will actually arrive. Given a train's original arrival time in 24-hour format (0-23 hours) and the delay duration in hours, determine the actual arrival time.
The challenge is handling time wraparound - if a train scheduled to arrive at 22:00 is delayed by 5 hours, it will arrive at 03:00 the next day. Your task is to implement the clock arithmetic correctly.
Input: Two positive integers - arrivalTime (0-23) and delayedTime (any positive integer)
Output: An integer representing the final arrival time in 24-hour format (0-23)
Example: If a train arrives at hour 15 with a 8-hour delay, it arrives at hour (15 + 8) % 24 = 23
Input & Output
Constraints
- 1 โค arrivalTime โค 24
- 1 โค delayedTime โค 104
- Note: arrivalTime is in 24-hour format where 1 represents 01:00, 24 represents 00:00 (midnight)