From 2393f86448a3ae64514bfc4dea3ab0bb2d5fc8f0 Mon Sep 17 00:00:00 2001 From: hbm666 <1208415748@qq.com> Date: Sun, 27 Aug 2023 11:17:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=94=B9=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/剑指Offer58-II.左旋转字符串.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/problems/剑指Offer58-II.左旋转字符串.md b/problems/剑指Offer58-II.左旋转字符串.md index a3fb7ab3..f58135eb 100644 --- a/problems/剑指Offer58-II.左旋转字符串.md +++ b/problems/剑指Offer58-II.左旋转字符串.md @@ -120,8 +120,9 @@ class Solution { ``` ```java -//解法二:空间复杂度:O(1)。用原始数组来进行反转操作 -//思路为:先整个字符串反转,再反转前面的,最后反转后面 n 个 +// 解法二 +// 空间复杂度:O(n)。String 的 toCharArray() 方法底层会 new 一个和原字符串相同大小的 char 数组 +// 思路为:先整个字符串反转,再反转前面的,最后反转后面 n 个 class Solution { public String reverseLeftWords(String s, int n) { char[] chars = s.toCharArray(); @@ -418,3 +419,4 @@ impl Solution { + From a03b6a37de06660adabcb44fc32fdaed2fc54046 Mon Sep 17 00:00:00 2001 From: hbm666 <1208415748@qq.com> Date: Sun, 27 Aug 2023 11:52:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/剑指Offer58-II.左旋转字符串.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/problems/剑指Offer58-II.左旋转字符串.md b/problems/剑指Offer58-II.左旋转字符串.md index f58135eb..310f2092 100644 --- a/problems/剑指Offer58-II.左旋转字符串.md +++ b/problems/剑指Offer58-II.左旋转字符串.md @@ -418,5 +418,4 @@ impl Solution {

- - + \ No newline at end of file From a2f4933faa0dcaf2d4de49ab3d951f1e20261ca0 Mon Sep 17 00:00:00 2001 From: hbm666 <1208415748@qq.com> Date: Sun, 27 Aug 2023 11:54:02 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=86=8D=E6=AC=A1=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/剑指Offer58-II.左旋转字符串.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/problems/剑指Offer58-II.左旋转字符串.md b/problems/剑指Offer58-II.左旋转字符串.md index 310f2092..a516213c 100644 --- a/problems/剑指Offer58-II.左旋转字符串.md +++ b/problems/剑指Offer58-II.左旋转字符串.md @@ -418,4 +418,4 @@ impl Solution {

- \ No newline at end of file +