Skip to content

Commit

Permalink
fix: two_sum solution
Browse files Browse the repository at this point in the history
  • Loading branch information
tednaaa committed Sep 3, 2024
1 parent 01c4a46 commit 767f7a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/two_sum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> {
let diff = target - number;

if let Some(&j) = map.get(&diff) {
return vec![i as i32, j as i32];
return vec![j as i32, i as i32];
}

map.insert(number, i);
Expand Down

0 comments on commit 767f7a4

Please sign in to comment.