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

Commit05de575

Browse files
committed
update: update 004
1 parenteccbf72 commit05de575

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

‎note/006/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,19 @@ string convert(string text, int nRows);
2727

2828
题意是让你把字符串按波浪形排好,然后返回横向读取的字符串。
2929

30-
听不懂的话,看下图应该就明白了
30+
听不懂的话,看下面的表示应该就明白了
3131

3232
```
33-
3433
0 2n-2 4n-4
3534
1 2n-3 2n-1 4n-5 4n-5
3635
2 2n-4 2n 4n-6 .
3736
. . . . .
3837
. n+1 . 3n-1 .
3938
n-2 n 3n-4 3n-2 5n-6
4039
n-1 3n-3 5n-5
41-
4240
```
4341

44-
那么我们可以根据上图找规律,可以看到最波峰和波谷是单顶点的,它们周期是`2 * (n - 1)`,单独处理即可;中间的部分每个周期会出现两次,规律很好找,留给读者自己想象,不懂的可以结合以下代码。
42+
那么我们可以根据上面找规律,可以看到波峰和波谷是单顶点的,它们周期是`2 * (n - 1)`,单独处理即可;中间的部分每个周期会出现两次,规律很好找,留给读者自己想象,不懂的可以结合以下代码。
4543

4644
```java
4745
classSolution {
@@ -72,7 +70,7 @@ class Solution {
7270

7371
##思路 1
7472

75-
另外一种思路就是开辟相应行数的`StringBuilder` 对象,然后模拟波浪生成的样子分别插入到相应的`StringBuilder` 对象,具体代码如下,比较直白简单。
73+
另外一种思路就是开辟相应行数的`StringBuilder` 对象,然后模拟波浪生成的样子分别插入到相应的`StringBuilder` 对象,比较直白简单,具体代码如下
7674

7775
```java
7876
classSolution {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp