mirror of
https://github.com/krahets/hello-algo.git
synced 2025-02-02 22:43:50 +08:00
🌈 style(codes/rust): add miss comment in leetcode_two_sums and time_complexity
This commit is contained in:
parent
a5425b6d9b
commit
28e9e4ceb6
@ -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);
|
||||
}
|
@ -15,6 +15,7 @@ fn constant(n: i32) -> i32 {
|
||||
count
|
||||
}
|
||||
|
||||
/* 线性阶 */
|
||||
fn linear(n: i32) -> i32 {
|
||||
let mut count = 0;
|
||||
for _ in 0..n {
|
||||
|
Loading…
Reference in New Issue
Block a user