10000 1 · Ainevsia/Leetcode-Rust@23c2e39 · GitHub
[go: up one dir, main page]

Skip to content

Commit 23c2e39

Browse files
committed
1
1 parent cb642a2 commit 23c2e39

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

notes/src/day1/lc704.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,18 @@ impl Solution {
112112
}
113113
}
114114

115+
```
116+
117+
使用rust std
118+
119+
```rust
120+
impl Solution {
121+
pub fn search(nums: Vec<i32>, target: i32) -> i32 {
122+
match nums.binary_search(&target) {
123+
Ok(idx) => { idx as i32 }
124+
Err(_) => { -1i32 }
125+
}
126+
}
127+
}
128+
115129
```

0 commit comments

Comments
 (0)
0