mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-17 14:10:57 +00:00
cargo fmt rust code (#1131)
* cargo fmt code * Add empty line to seperate unrelated comments * Fix review * Update bubble_sort.rs * Update merge_sort.rs --------- Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
@@ -30,7 +30,7 @@ pub fn two_sum_hash_table(nums: &Vec<i32>, target: i32) -> Option<Vec<i32>> {
|
||||
for (i, num) in nums.iter().enumerate() {
|
||||
match dic.get(&(target - num)) {
|
||||
Some(v) => return Some(vec![*v as i32, i as i32]),
|
||||
None => dic.insert(num, i as i32)
|
||||
None => dic.insert(num, i as i32),
|
||||
};
|
||||
}
|
||||
None
|
||||
@@ -38,7 +38,7 @@ pub fn two_sum_hash_table(nums: &Vec<i32>, target: i32) -> Option<Vec<i32>> {
|
||||
|
||||
fn main() {
|
||||
// ======= Test Case =======
|
||||
let nums = vec![ 2, 7, 11, 15 ];
|
||||
let nums = vec![2, 7, 11, 15];
|
||||
let target = 13;
|
||||
|
||||
// ====== Driver Code ======
|
||||
|
||||
Reference in New Issue
Block a user