From e41471fdf603d435e58f4b412774b3f6bc2ff82a Mon Sep 17 00:00:00 2001 From: Logen <47022821+Logenleedev@users.noreply.github.com> Date: Mon, 13 Feb 2023 08:59:42 -0600 Subject: [PATCH 1/2] minor modification --- problems/0509.斐波那契数.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/problems/0509.斐波那契数.md b/problems/0509.斐波那契数.md index 69306801..08175058 100644 --- a/problems/0509.斐波那契数.md +++ b/problems/0509.斐波那契数.md @@ -219,9 +219,6 @@ class Solution: def fib(self, n: int) -> int: # 排除 Corner Case - if n == 1: - return 1 - if n == 0: return 0 From 633293b509052780afc83b23c07a4ad79ba18156 Mon Sep 17 00:00:00 2001 From: Logen <47022821+Logenleedev@users.noreply.github.com> Date: Tue, 14 Feb 2023 19:23:52 -0600 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=A3=E9=A2=98?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/剑指Offer58-II.左旋转字符串.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/problems/剑指Offer58-II.左旋转字符串.md b/problems/剑指Offer58-II.左旋转字符串.md index 1b619ffb..49480abf 100644 --- a/problems/剑指Offer58-II.左旋转字符串.md +++ b/problems/剑指Offer58-II.左旋转字符串.md @@ -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