Skip to content

Commit 629157b

Browse files
Create 0263-ugly-number.js
1 parent 2d0e0cc commit 629157b

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)