|
1 |
| -Write a function that reverses a string. The input string is given as an array of characters s. |
| 1 | +Write a function that reverses a string. The input string is given as an array of characters `s`. |
2 | 2 |
|
3 |
| -You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with O(1) extra memory. |
| 3 | +You must do this by modifying the input array [in-place](https://en.wikipedia.org/wiki/In-place_algorithm) with `O(1)` extra memory. |
4 | 4 |
|
5 | 5 | Example 1:
|
6 | 6 |
|
7 |
| -> Input: s = ["h","e","l","l","o"]<br> |
8 |
| -> Output: ["o","l","l","e","h"] |
| 7 | +> <span style="color: white;">Input</span>: s = ["h","e","l","l","o"]<br> |
| 8 | +> <span style="color: white;">Output</span>: ["o","l","l","e","h"] |
9 | 9 |
|
10 | 10 | Example 2:
|
11 | 11 |
|
12 |
| -> Input: s = ["H","a","n","n","a","h"]<br> |
13 |
| -> Output: ["h","a","n","n","a","H"] |
| 12 | +> <span style="color: white;">Input</span>: s = ["H","a","n","n","a","h"]<br> |
| 13 | +> <span style="color: white;">Output</span>: ["h","a","n","n","a","H"] |
14 | 14 |
|
15 | 15 | Constraints:
|
16 | 16 |
|
17 |
| -- 1 <= s.length <= 105 |
18 |
| -- s[i] is a [printable ascii character](https://en.wikipedia.org/wiki/ASCII#Printable_characters). |
| 17 | +- 1 <= s.length <= 10<sup>5</sup> |
| 18 | +- `s[i]` is a [printable ascii character](https://en.wikipedia.org/wiki/ASCII#Printable_characters). |
0 commit comments