Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1e9ae21

Browse files
committed
opt: opt 038
1 parent10306ab commit1e9ae21

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

‎note/038/README.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,39 @@
22

33
##Description
44

5-
The count-and-say sequence is the sequence of integersbeginningasfollows:
5+
The count-and-say sequence is the sequence of integerswith the first five termsasfollowing:
66

7-
`1, 11, 21, 1211, 111221, ...`
7+
```
8+
1. 1
9+
2. 11
10+
3. 21
11+
4. 1211
12+
5. 111221
813
9-
`1` is read off as`"one 1"` or`11`.
14+
```
1015

16+
`1` is read off as`"one 1"` or`11`.
1117
`11` is read off as`"two 1s"` or`21`.
12-
1318
`21` is read off as`"one 2`, then`one 1"` or`1211`.
1419

15-
Given an integer*n*, generate the*n*<sup>th</sup> sequence.
20+
Given an integer*n*, generate the*n*th term of the count-and-say sequence.
21+
22+
Note: Each term of the sequence of integers will be represented as a string.
23+
24+
**Example 1:**
1625

17-
Note: The sequence of integers will be represented as a string.
26+
```
27+
Input: 1
28+
Output: "1"
29+
30+
```
31+
32+
**Example 2:**
33+
34+
```
35+
Input: 4
36+
Output: "1211"
37+
```
1838

1939
**Tags:** String
2040

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp