[LeetCode] Calculate Delayed Arrival Time

2651. Calculate Delayed Arrival Time

You are given a positive integer arrivalTime denoting the arrival time of a train in hours, and another positive integer delayedTime denoting the amount of delay in hours.

Return the time when the train will arrive at the station.

Note that the time in this problem is in 24-hours format.

1
2
3
4
5
6
7
class Solution {
public:
int findDelayedArrivalTime(int arrivalTime, int delayedTime) {
return (arrivalTime + delayedTime) % 24;
}
};

Author: Song Hayoung
Link: https://songhayoung.github.io/2023/04/23/PS/LeetCode/calculate-delayed-arrival-time/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.