Skip to content

Commit 137e4e9

Browse files
authored
Merge pull request #1761 from AP-Repositories/patch-38
Create 0263-ugly-number.js
2 parents 9f93b33 + 629157b commit 137e4e9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

javascript/0263-ugly-number.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
var isUgly = function(n) {
2+
if(n <= 0)
3+
return false;
4+
5+
for(const p of [2, 3, 5])
6+
while(n % p == 0)
7+
n = n / p;
8+
return n == 1;
9+
};

0 commit comments

Comments
 (0)