-
Notifications
You must be signed in to change notification settings - Fork 0
/
solution0071.js
46 lines (34 loc) · 860 Bytes
/
solution0071.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
--------------- 8 Kyu - Beginner Series #2 Clock ------------------
Instructions:
Clock shows h hours, m minutes and s seconds after midnight.
Your task is to write a function which returns the time since midnight in milliseconds.
Example:
h = 0
m = 1
s = 1
result = 61000
Input constraints:
0 <= h <= 23
0 <= m <= 59
0 <= s <= 59
-------------
Sample Tests
describe("Fixed Tests", () => {
it("Tests", () => {
Test.assertEquals(past(0,1,1),61000)
Test.assertEquals(past(1,1,1),3661000)
Test.assertEquals(past(0,0,0),0)
Test.assertEquals(past(1,0,1),3601000)
Test.assertEquals(past(1,0,0),3600000)
});
});
--------------
Psuedo Code:
- find millisecs per hour, minute, second
- use those numbers to write function which multiplies each
------
*/
function past(h, m, s){
return ((h*3600000) + (m*60000) + (s*1000) )
}