We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 273036c commit 0e8c66dCopy full SHA for 0e8c66d
README.md
@@ -10,6 +10,8 @@ leetcode 测试
10
11
##### 包含的内容如下
12
13
+https://leetcode.cn/problems/ugly-number/
14
+
15
https://leetcode.cn/problems/get-kth-magic-number-lcci/
16
17
https://leetcode.cn/problems/sort-integers-by-the-power-value/
ugly-number/index.ts
@@ -0,0 +1,13 @@
1
+function isUgly(n: number): boolean {
2
+ if (n <= 0) {
3
+ return false;
4
+ }
5
6
+ for (const factor of [2, 3, 5]) {
7
+ while (n % factor === 0) {
8
+ n /= factor;
9
+ return n == 1;
+}
+export default isUgly;
0 commit comments