Skip to content

Commit a9c0d54

Browse files
committed
1
1 parent b211c3a commit a9c0d54

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

notes/src/day1/lc27.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl Solution {
7070
std强大的标准库 Vec上retain方法
7171

7272
```rust
73-
73+
# struct Solution {}
7474
impl Solution {
7575
pub fn remove_element(nums: &mut Vec<i32>, val: i32) -> i32 {
7676
nums.retain(|&x| x != val);
@@ -83,6 +83,7 @@ impl Solution {
8383
slow指针用来存储需要留下元素应该存放的地址,fast指针是当前处理的元素
8484

8585
```rust
86+
# struct Solution {}
8687
impl Solution {
8788
pub fn remove_element(nums: &mut Vec<i32>, val: i32) -> i32 {
8889
let mut slow: usize = 0usize; // the result elem

notes/src/day1/lc704.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl Solution {
9191
- `Ordering::Less => { right = mid }` 要注意“右开” 又写错了
9292

9393
```rust
94-
94+
# struct Solution {}
9595
use std::cmp::Ordering;
9696

9797
impl Solution {
@@ -117,6 +117,7 @@ impl Solution {
117117
使用rust std
118118

119119
```rust
120+
# struct Solution {}
120121
impl Solution {
121122
pub fn search(nums: Vec<i32>, target: i32) -> i32 {
122123
match nums.binary_search(&target) {
@@ -126,6 +127,9 @@ impl Solution {
126127
}
127128
}
128129

130+
131+
```rust
132+
# struct Solution {}
129133
impl Solution {
130134
pub fn search(nums: Vec<i32>, target: i32) -> i32 {
131135
let idx: usize = nums.partition_point(|&x| x < target);

0 commit comments

Comments
 (0)