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 #34

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 15 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Jul 14, 2022
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
237dc9d
添加(0925.长按键入.md):增加typescript版本
xiaofei-2020 Jun 8, 2022
cded6c5
Update 0110.平衡二叉树.md python code via iterate
ExplosiveBattery Jun 8, 2022
e354cd6
Update 0101.对称二叉树.md level order traversal
ExplosiveBattery Jun 8, 2022
0e41479
Merge pull request #1 from ExplosiveBattery/ExplosiveBattery-patch-0101
ExplosiveBattery Jun 8, 2022
beb6805
添加 1049.最后一块石头的重量.md C语言解法
KingArthur0205 Jun 23, 2022
ed3f6a0
Merge branch 'master' of https://github.com/KingArthur0205/leetcode-m...
KingArthur0205 Jun 23, 2022
16af63e
修改0349 - 用 Java stream 代替 for loop (这样主题更明显)
WWWonderer Jun 28, 2022
0cd4ffd
修正:移除链表元素TS版本代码错误
Jun 29, 2022
0c1c77c
添加 剑指Offer 58-II.左旋转字符串 Rust版本
cezarbbb Jul 13, 2022
a9f6b5d
Merge pull request #1452 from xiaofei-2020/exStr01
youngyangyang04 Jul 14, 2022
a59a4ab
Merge pull request #1518 from cezarbbb/String
youngyangyang04 Jul 14, 2022
6d0d643
Merge pull request #1453 from ExplosiveBattery/master
youngyangyang04 Jul 14, 2022
dee6bbd
Merge pull request #1504 from LinStan/update/listnode_ts
youngyangyang04 Jul 14, 2022
0b25121
Merge pull request #1499 from s-zhang-cs/0349
youngyangyang04 Jul 14, 2022
f2b5da5
Merge pull request #1492 from KingArthur0205/master
youngyangyang04 Jul 14, 2022
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
添加 剑指Offer 58-II.左旋转字符串 Rust版本
添加 剑指Offer 58-II.左旋转字符串 Rust版本
  • Loading branch information
cezarbbb committed Jul 13, 2022
commit 0c1c77c23412b3a8ebba93fde9017ca8d820936e
25 changes: 24 additions & 1 deletion problems/剑指Offer58-II.左旋转字符串.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,30 @@ object Solution {
}
```


Rust:

```Rust
impl Solution {
pub fn reverse(s: &mut Vec<char>, mut begin: usize, mut end: usize){
while begin < end {
let temp = s[begin];
s[begin] = s[end];
s[end] = temp;
begin += 1;
end -= 1;
}
}
pub fn reverse_left_words(s: String, n: i32) -> String {
let len = s.len();
let mut s = s.chars().collect::<Vec<char>>();
let n = n as usize;
Self::reverse(&mut s, 0, n - 1);
Self::reverse(&mut s, n, len - 1);
Self::reverse(&mut s, 0, len - 1);
s.iter().collect::<String>()
}
}
```



Expand Down

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