remove pointless ifs
This commit is contained in:
parent
ae5d866555
commit
e8b350b64b
1 changed files with 2 additions and 10 deletions
|
@ -17,17 +17,9 @@ fn foo(nums: &mut [i32], k: i32) -> i32 {
|
|||
let rv = nums[right];
|
||||
let sum = lv + rv;
|
||||
if sum < k {
|
||||
if lv < rv {
|
||||
left += 1;
|
||||
} else {
|
||||
right -= 1;
|
||||
}
|
||||
left += 1;
|
||||
} else if sum > k {
|
||||
if rv > lv {
|
||||
right -= 1;
|
||||
} else {
|
||||
left += 1;
|
||||
}
|
||||
right -= 1;
|
||||
} else {
|
||||
max += 1;
|
||||
left += 1;
|
||||
|
|
Loading…
Reference in a new issue