We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 444ada3 commit f0f1ed3Copy full SHA for f0f1ed3
1904-the-number-of-full-rounds-you-have-played.js
@@ -0,0 +1,11 @@
1
+/**
2
+ * @param {string} startTime
3
+ * @param {string} finishTime
4
+ * @return {number}
5
+ */
6
+const numberOfRounds = function(startTime, finishTime) {
7
+ let start = 60 * parseInt(startTime.slice(0, 2)) + parseInt(startTime.slice(3))
8
+ let finish = 60 * parseInt(finishTime.slice(0, 2)) + parseInt(finishTime.slice(3));
9
+ if (start > finish) finish += 60 * 24; // If `finishTime` is earlier than `startTime`, add 24 hours to `finishTime`.
10
+ return Math.floor(finish / 15) - Math.ceil(start / 15); // floor(finish / 15) - ceil(start / 15)
11
+};
0 commit comments