just iterate
This commit is contained in:
parent
1c2b0ba376
commit
d2df4afd3d
1 changed files with 2 additions and 2 deletions
|
@ -13,8 +13,8 @@ fn l(nums: Vec<i32>, k: i32) -> i32 {
|
||||||
let mut end: i32 = -1;
|
let mut end: i32 = -1;
|
||||||
let nums = &nums;
|
let nums = &nums;
|
||||||
|
|
||||||
while end < len - 1 {
|
for i in 0..len {
|
||||||
end += 1;
|
end = i;
|
||||||
if nums[end as usize] == 0 {
|
if nums[end as usize] == 0 {
|
||||||
k -= 1;
|
k -= 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue