Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pull] master from youngyangyang04:master #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 20 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Jul 20, 2023
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
607e4eb
更新 哈希表理论基础 排版格式修复
jinbudaily Jul 19, 2023
c628aa6
更新 0242.有效的字母异位词 排版格式修复
jinbudaily Jul 19, 2023
19dfa98
更新 0349.两个数组的交集 排版格式修复
jinbudaily Jul 19, 2023
764b3e9
更新 0202.快乐数 排版格式修复
jinbudaily Jul 19, 2023
23950d1
更新 001.两数之和 排版格式修复
jinbudaily Jul 19, 2023
2948791
更新 0454.四数相加II 排版格式修复
jinbudaily Jul 19, 2023
0922ede
更新 0383.赎金信 排版格式修复
jinbudaily Jul 19, 2023
eb2cdf2
更新 0015.三数之和 排版格式修复
jinbudaily Jul 19, 2023
3fe673d
更新 0018.四数之和 排版格式修复
jinbudaily Jul 19, 2023
ddee6ad
更新 哈希表总结 排版格式修复
jinbudaily Jul 19, 2023
4ae8843
Merge branch 'master' of github.com:jinbudaily/leetcode-master
jinbudaily Jul 19, 2023
00ef608
更新 0344.反转字符串 排版格式修复
jinbudaily Jul 19, 2023
5cb2501
更新 0541.反转字符串 排版格式修复
jinbudaily Jul 19, 2023
963eb8f
更新 剑指Offer05.替换空格 排版格式修复
jinbudaily Jul 19, 2023
e70ca92
更新 0151.反转字符串中的单词 排版格式修复
jinbudaily Jul 19, 2023
370a4d1
更新 剑指Offer58-II.左旋转字符串 排版格式修复
jinbudaily Jul 19, 2023
5acebcc
更新 0028.实现strStr 排版格式修复
jinbudaily Jul 19, 2023
202dd38
更新 0459.重复的字符串 排版格式修复
jinbudaily Jul 19, 2023
4fe1f08
更新 字符串总结 排版格式修复
jinbudaily Jul 19, 2023
406cada
Merge pull request #2191 from jinbudaily/master
youngyangyang04 Jul 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
更新 剑指Offer58-II.左旋转字符串 排版格式修复
  • Loading branch information
jinbudaily committed Jul 19, 2023
commit 370a4d1c05b1204c652c00bcb90702947df11795
26 changes: 13 additions & 13 deletions problems/剑指Offer58-II.左旋转字符串.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
限制:
1 <= k < s.length <= 10000

# 思路
## 思路

为了让本题更有意义,提升一下本题难度:**不能申请额外空间,只能在本串上操作**。

Expand Down Expand Up @@ -71,7 +71,7 @@ public:

是不是发现这代码也太简单了,哈哈。

# 总结
## 总结


此时我们已经反转好多次字符串了,来一起回顾一下吧。
Expand All @@ -86,7 +86,7 @@ public:

好了,反转字符串一共就介绍到这里,相信大家此时对反转字符串的常见操作已经很了解了。

# 题外话
## 题外话

一些同学热衷于使用substr,来做这道题。
其实使用substr 和 反转 时间复杂度是一样的 ,都是O(n),但是使用substr申请了额外空间,所以空间复杂度是O(n),而反转方法的空间复杂度是O(1)。
Expand All @@ -96,7 +96,8 @@ public:

## 其他语言版本

Java:
### Java:

```java
class Solution {
public String reverseLeftWords(String s, int n) {
Expand Down Expand Up @@ -141,7 +142,7 @@ class Solution {
}
```

python:
### python:
(版本一)使用切片

```python
Expand Down Expand Up @@ -211,7 +212,7 @@ class Solution:

```

Go:
### Go:

```go
func reverseLeftWords(s string, n int) string {
Expand All @@ -234,8 +235,7 @@ func reverse(b []byte, left, right int){
}
```


JavaScript:
### JavaScript:

```javascript
var reverseLeftWords = function(s, n) {
Expand Down Expand Up @@ -279,7 +279,7 @@ var reverseLeftWords = function (s, n) {
};
```

TypeScript:
### TypeScript:

```typescript
function reverseLeftWords(s: string, n: number): string {
Expand Down Expand Up @@ -311,7 +311,7 @@ function reverseLeftWords(s: string, n: number): string {
};
```

Swift:
### Swift:

```swift
func reverseLeftWords(_ s: String, _ n: Int) -> String {
Expand Down Expand Up @@ -358,8 +358,7 @@ function reverse(&$s, $start, $end) {
}
```


Scala:
### Scala:

```scala
object Solution {
Expand Down Expand Up @@ -388,7 +387,7 @@ object Solution {
}
```

Rust:
### Rust:

```Rust
impl Solution {
Expand Down Expand Up @@ -419,3 +418,4 @@ impl Solution {
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
</a>

AltStyle によって変換されたページ (->オリジナル) /