> For the complete documentation index, see [llms.txt](https://r24zeng.gitbook.io/leetcode-notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://r24zeng.gitbook.io/leetcode-notebook/bu-chong-81100-dao/344.-reverse-string.md).

# 344. Reverse String

\# Easy

{% hint style="info" %}
如果**list**长度是偶数，则`len(s)/2`作为`index`是中间偏前一位

如果**list**长度是奇数，则`len(s)/2`作为`index`是中间那位
{% endhint %}

{% tabs %}
{% tab title="Python" %}

```python
class Solution:
    def reverseString(self, s: List[str]) -> None:
        """
        Do not return anything, modify s in-place instead.
        """
        l = len(s)
        for i in range(l//2):
            tmp = s[i]
            s[i] = s[l-i-1]
            s[l-i-1] = tmp
```

{% endtab %}
{% endtabs %}
