mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 07:51:41 +08:00
update
This commit is contained in:
19
leetcode/problem/reverse-string.html
Normal file
19
leetcode/problem/reverse-string.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<p>Write a function that reverses a string. The input string is given as an array of characters <code>s</code>.</p>
|
||||
|
||||
<p>You must do this by modifying the input array <a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank">in-place</a> with <code>O(1)</code> extra memory.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
<pre><strong>Input:</strong> s = ["h","e","l","l","o"]
|
||||
<strong>Output:</strong> ["o","l","l","e","h"]
|
||||
</pre><p><strong>Example 2:</strong></p>
|
||||
<pre><strong>Input:</strong> s = ["H","a","n","n","a","h"]
|
||||
<strong>Output:</strong> ["h","a","n","n","a","H"]
|
||||
</pre>
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= s.length <= 10<sup>5</sup></code></li>
|
||||
<li><code>s[i]</code> is a <a href="https://en.wikipedia.org/wiki/ASCII#Printable_characters" target="_blank">printable ascii character</a>.</li>
|
||||
</ul>
|
Reference in New Issue
Block a user