提交 d94a58e5 编写于 作者: 每日一练社区's avatar 每日一练社区

update exercises

上级 93c81596
# Z 字形变换 # Z 字形变换
<div class="notranslate"> 将一个给定字符串 `s` 根据给定的行数 `numRows` ,以从上往下、从左到右进行 Z 字形排列。
<p>将一个给定字符串 <code>s</code> 根据给定的行数 <code>numRows</code> ,以从上往下、从左到右进行&nbsp;Z 字形排列。</p>
<p>比如输入字符串为 <code>"PAYPALISHIRING"</code>&nbsp;行数为 <code>3</code> 时,排列如下:</p> 比如输入字符串为 `"PAYPALISHIRING"` 行数为 `3` 时,排列如下:
<pre>
P A H N ```
A P L S I I G P A H N
Y I R</pre> A P L S I I G
Y I R
```
之后,你的输出需要从左往右逐行读取,产生出一个新的字符串,比如:`"PAHNAPLSIIGYIR"`
请你实现这个将字符串进行指定行数变换的函数:
```c
string convert(string s, int numRows);
```
**示例 1:**
<p>之后,你的输出需要从左往右逐行读取,产生出一个新的字符串,比如:<code>"PAHNAPLSIIGYIR"</code>。</p>
**输入:** s = "PAYPALISHIRING", numRows = 3
<p>请你实现这个将字符串进行指定行数变换的函数:</p> **输出:** "PAHNAPLSIIGYIR"
<pre>string convert(string s, int numRows);</pre> **示例 2:**
<p>&nbsp;</p> **输入:** s = "PAYPALISHIRING", numRows = 4
<p><strong>示例 1:</strong></p> **输出:** "PINALSIGYAHRPI"
<pre><strong>输入:</strong>s = "PAYPALISHIRING", numRows = 3 **解释:**
<strong><br />输出:</strong>"PAHNAPLSIIGYIR"
</pre>
<strong>示例 2:</strong>
<pre><strong>输入:</strong>s = "PAYPALISHIRING", numRows = 4 ```
<strong><br />输出:</strong>"PINALSIGYAHRPI"
<strong><br />解释:</strong>
P I N P I N
A L S I G A L S I G
Y A H R Y A H R
P I P I
</pre> ```
**示例 3:**
<p><strong>示例 3:</strong></p>
**输入:** s = "A", numRows = 1
<pre><strong>输入:</strong>s = "A", numRows = 1 **输出:** "A"
<strong><br />输出:</strong>"A"
</pre>
<p>&nbsp;</p> **提示:**
<p><strong>提示:</strong></p> * `1 <= s.length <= 1000`
* `s` 由英文字母(小写和大写)、`','``'.'` 组成
* `1 <= numRows <= 1000`
<ul>
<li><code>1 &lt;= s.length &lt;= 1000</code></li>
<li><code>s</code> 由英文字母(小写和大写)、<code>','</code> 和 <code>'.'</code> 组成</li>
<li><code>1 &lt;= numRows &lt;= 1000</code></li>
</ul>
</div>
<p>以下<span style="color:red">错误</span>的选项是?</p> <p>以下<span style="color:red">错误</span>的选项是?</p>
## aop ## aop
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册