summaryrefslogtreecommitdiff
path: root/search-insert-position/src/main.rs
blob: 50ad33350c0f0e27455175a6fd0f34752e4236cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
fn main() {
    println!("Hello, world!");
}

struct Solution {}
impl Solution {
    pub fn search_insert(nums: Vec<i32>, target: i32) -> i32 {
        nums.partition_point(|&x| x < target) as i32
        // nums.binary_search(&target).unwrap_or_else(|x| x) as i32

    }
}