---
description: '# Easy'
---

# 344. Reverse String

{% 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 %}
