Skip to content

Commit c31fd65

Browse files
committed
generate-a-string-with-characters-that-have-odd-counts/
1 parent d1ca13d commit c31fd65

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ leetcode 测试
1010

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

13+
https://leetcode.cn/problems/generate-a-string-with-characters-that-have-odd-counts/
14+
1315
https://leetcode.cn/problems/maximum-number-of-groups-entering-a-competition/
1416

1517
https://leetcode.cn/problems/largest-component-size-by-common-factor
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default function generateTheString(n: number): string {
2+
if (n % 2 === 1) {
3+
return "a".repeat(n);
4+
}
5+
return "a".repeat(n - 1) + "b";
6+
}

0 commit comments

Comments
 (0)