🌈 style(codes/rust): add miss comment in leetcode_two_sums and time_complexity

This commit is contained in:
xblakicex 2023-01-14 18:25:18 +01:00
parent a5425b6d9b
commit 28e9e4ceb6
2 changed files with 5 additions and 1 deletions

View File

@ -35,13 +35,16 @@ impl SolutionHashMap {
}
}
// Driver Code
fn main() {
// ======= Test Case =======
let nums = vec![2,7,11,15];
let target = 9;
// 方法一
let res = SolutionBruteForce::two_sum(&nums, target);
println!("方法一 res = {:?}", res);
// 方法二
let res = SolutionHashMap::two_sum(&nums, target);
println!("方法二 res = {:?}", res);
}

View File

@ -15,6 +15,7 @@ fn constant(n: i32) -> i32 {
count
}
/* 线性阶 */
fn linear(n: i32) -> i32 {
let mut count = 0;
for _ in 0..n {