Skip to content

Commit f356910

Browse files

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ leetcode 测试
1010

1111
##### 包含的内容如下
1212

13+
https://leetcode.cn/problems/bulb-switcher/
14+
1315
https://leetcode.cn/problems/concatenated-words/
1416

1517
https://leetcode.cn/problems/tag-validator/
1618

1719
https://leetcode.cn/problems/guess-the-word/
1820

21+
https://leetcode.cn/problems/bulb-switcher-ii/
22+
1923
https://leetcode.cn/problems/most-common-word/
2024

2125
https://leetcode-cn.com/problems/uncommon-words-from-two-sentences/

bulb-switcher-ii/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default function flipLights(n: number, m: number): number {
2+
if (!n || !m) return 1;
3+
else if (n == 1) return 2;
4+
else if (n == 2) return 3 + Number(m > 1);
5+
else {
6+
if (m == 1) return 4;
7+
else if (m == 2) return 7;
8+
else return 8;
9+
}
10+
}

bulb-switcher/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function bulbSwitch(n: number): number {
2+
return Math.floor(Math.sqrt(n));
3+
}

0 commit comments

Comments
 (0)