mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-06 23:28:29 +08:00
添加解题方法
This commit is contained in:
@ -194,6 +194,18 @@ class Solution:
|
||||
|
||||
```
|
||||
|
||||
```python 3
|
||||
# 方法五:另类的切片方法
|
||||
class Solution:
|
||||
def reverseLeftWords(self, s: str, n: int) -> str:
|
||||
n = len(s)
|
||||
s = s + s
|
||||
return s[k : n+k]
|
||||
|
||||
# 时间复杂度:O(n)
|
||||
# 空间复杂度:O(n)
|
||||
```
|
||||
|
||||
Go:
|
||||
|
||||
```go
|
||||
|
Reference in New Issue
Block a user