1
var simplifiedFractions = function (n) {
2
const res = [];
3
const checkValid = (a, b) => {
4
if (a === 1) return 1;
5
let num = 2;
6
while (num <= a) {
7
if (b % num === 0 && a % num === 0) return num;
8
num++;
9
}
10
return 1;
11
};
12
let i = 1;
13
while (i / n < 1) {
14
let j = i + 1;
15
while (j <= n) {
16
if (checkValid(i, j) < 2) {
17
res.push(`${i}/${j}`);
18
}
19
j++;
20
}
21
i++;
22
}
23
return res;
24
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0