Skip to content

Commit 67eb3bf

Browse files
committed
Create 2651-calculate-delayed-arrival-time.js
1 parent b0f3f52 commit 67eb3bf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* @param {number} arrivalTime
3+
* @param {number} delayedTime
4+
* @return {number}
5+
*/
6+
var findDelayedArrivalTime = function (arrivalTime, delayedTime) {
7+
let totalTime = arrivalTime + delayedTime; // initialize totalTime is the sum of arrivalTime and delayedTime
8+
9+
if (totalTime == 24) { // if totalTime is equal to 24 then return 0
10+
return 0;
11+
} else if (totalTime < 24) { // if totalTime is less than 24 then return totalTime
12+
return totalTime;
13+
} else { // else return subtraction of totalTime to 24
14+
return totalTime - 24;
15+
}
16+
};

0 commit comments

Comments
 (0)