Skip to content

Commit 532f57b

Browse files
committed
Added Beautiful-Days problem solution
1 parent d221f2f commit 532f57b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Beautiful Days/main.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env node
2+
3+
// Problem Description at -> https://www.hackerrank.com/challenges/beautiful-days-at-the-movies/problem
4+
5+
6+
function beautifulDays(i, j, k) {
7+
let numOfBeautifulDays = 0;
8+
for (let start = i; start <= j; start++) {
9+
const reverse = Number(String(start).split('').reverse().join(''));
10+
if ((start - reverse) % k == 0) numOfBeautifulDays++;
11+
}
12+
13+
return numOfBeautifulDays;
14+
}
15+
16+
console.log(beautifulDays(20, 23, 6)); // 2

0 commit comments

Comments
 (0)