Skip to content

Commit

Permalink
'1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ainevsia committed Jul 15, 2023
1 parent 261b548 commit 1a71c81
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions notes/src/day1/lc704.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
直接使用标准库的做法,slice的partition_point没有找到的时候返回数组的长度

```rust
struct Solution {}
# struct Solution {}
impl Solution {
pub fn search(nums: Vec<i32>, target: i32) -> i32 {
let x = nums.partition_point(|&x| x < target);
Expand All @@ -36,7 +36,7 @@ impl Solution {
手写的二分查找

```rust
struct Solution {}
# struct Solution {}
impl Solution {
pub fn search(nums: Vec<i32>, target: i32) -> i32 {
let mut left = 0;
Expand Down Expand Up @@ -64,7 +64,7 @@ impl Solution {
在左闭右闭区间的情况下 由于right 要 -1,所以要考虑right=0 - 1的情况

```rust
struct Solution {}
# struct Solution {}
impl Solution {
pub fn search(nums: Vec<i32>, target: i32) -> i32 {
let mut left = 0isize;
Expand Down

0 comments on commit 1a71c81

Please sign in to comment.