Package g0301_0400.s0344_reverse_string
Class Solution
java.lang.Object
g0301_0400.s0344_reverse_string.Solution
344 - Reverse String.<p>Easy</p>
<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="_top">in-place</a> with <code>O(1)</code> extra memory.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> s = [“h”,“e”,“l”,“l”,“o”]</p>
<p><strong>Output:</strong> [“o”,“l”,“l”,“e”,“h”]</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> s = [“H”,“a”,“n”,“n”,“a”,“h”]</p>
<p><strong>Output:</strong> [“h”,“a”,“n”,“n”,“a”,“H”]</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="_top">printable ascii character</a>.</li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
reverseString
public void reverseString(char[] s)
-