mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 07:35:35 +08:00
Merge pull request #1893 from Logenleedev/my-contribution
minor modification 去除多余代码
This commit is contained in:
@ -219,9 +219,6 @@ class Solution:
|
|||||||
def fib(self, n: int) -> int:
|
def fib(self, n: int) -> int:
|
||||||
|
|
||||||
# 排除 Corner Case
|
# 排除 Corner Case
|
||||||
if n == 1:
|
|
||||||
return 1
|
|
||||||
|
|
||||||
if n == 0:
|
if n == 0:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -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:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
Reference in New Issue
Block a user