Skip to content

Commit 1e9ae21

Browse files
committed
opt: opt 038
1 parent 10306ab commit 1e9ae21

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

note/038/README.md

+26-6
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 integers beginning as follows:
5+
The count-and-say sequence is the sequence of integers with the first five terms as following:
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)