File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -27,21 +27,19 @@ string convert(string text, int nRows);
2727
2828题意是让你把字符串按波浪形排好,然后返回横向读取的字符串。
2929
30- 听不懂的话,看下图应该就明白了 :
30+ 听不懂的话,看下面的表示应该就明白了 :
3131
3232``` 
33-   
34330 2n-2 4n-4 
35341 2n-3 2n-1 4n-5 4n-5 
36352 2n-4 2n 4n-6 . 
3736. . . . . 
3837. n+1 . 3n-1 . 
3938n-2 n 3n-4 3n-2 5n-6 
4039n-1 3n-3 5n-5 
41-   
4240``` 
4341
44- 那么我们可以根据上图找规律,可以看到最波峰和波谷是单顶点的 ,它们周期是 ` 2 * (n - 1) ` ,单独处理即可;中间的部分每个周期会出现两次,规律很好找,留给读者自己想象,不懂的可以结合以下代码。
42+ 那么我们可以根据上面找规律,可以看到波峰和波谷是单顶点的 ,它们周期是 ` 2 * (n - 1) ` ,单独处理即可;中间的部分每个周期会出现两次,规律很好找,留给读者自己想象,不懂的可以结合以下代码。
4543
4644``` java 
4745class  Solution  {
@@ -72,7 +70,7 @@ class Solution {
7270
7371## 思路 1  
7472
75- 另外一种思路就是开辟相应行数的 ` StringBuilder `  对象,然后模拟波浪生成的样子分别插入到相应的 ` StringBuilder `  对象,具体代码如下, 比较直白简单。
73+ 另外一种思路就是开辟相应行数的 ` StringBuilder `  对象,然后模拟波浪生成的样子分别插入到相应的 ` StringBuilder `  对象,比较直白简单,具体代码如下 。
7674
7775``` java 
7876class  Solution  {
                                 You can’t perform that action at this time. 
               
                  
0 commit comments