-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbottlesOfBeer.js
More file actions
32 lines (22 loc) · 783 Bytes
/
Copy pathbottlesOfBeer.js
File metadata and controls
32 lines (22 loc) · 783 Bytes
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
/*
[execution time limit] 4 seconds (js)
[input] integer n
Initial number of bottles (a positive integer)
[output] array.string
bottles_of_beer(99) = [
"99 bottles of beer on the wall, 99 bottles of beer.",
"Take one down, pass it around, 98 bottles of beer on the wall...",
"98 bottles of beer on the wall, 98 bottles of beer.",
"Take one down, pass it around, 97 bottles of beer on the wall...",
...
"1 bottle of beer on the wall, 1 bottle of beer.",
"Take one down, pass it around, no more bottles of beer on the wall...",
"No more bottles of beer on the wall, no more bottles of beer.",
"Go to the store and buy some more, 99 bottles of beer on the wall..."
]
Specs still failing but possibly due to syntax error.
try recursion.
*/
//DRY
function bottlesOfBeer(n) {
}