mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
Update 0151.翻转字符串里的单词.md
This commit is contained in:
@ -435,7 +435,7 @@ class Solution {
|
||||
|
||||
python:
|
||||
(版本一)先删除空白,然后整个反转,最后单词反转。
|
||||
#### 因为字符串是不可变类型,所以反转单词的时候,需要将其转换成列表,然后通过join函数再将其转换成列表,所以空间复杂度不是O(1)
|
||||
**因为字符串是不可变类型,所以反转单词的时候,需要将其转换成列表,然后通过join函数再将其转换成列表,所以空间复杂度不是O(1)**
|
||||
```Python
|
||||
class Solution:
|
||||
def reverseWords(self, s: str) -> str:
|
||||
|
Reference in New Issue
Block a user