diff --git a/where_will_the_ball_fall/src/main.rs b/where_will_the_ball_fall/src/main.rs index 85d994e..aadce8c 100644 --- a/where_will_the_ball_fall/src/main.rs +++ b/where_will_the_ball_fall/src/main.rs @@ -2,7 +2,7 @@ fn find_ball(grid: Vec>) -> Vec { let balls = grid[0].len(); let mut res = vec![-1; balls]; - for ball in 0..balls { + (0..balls).for_each(|ball| { let mut pos = ball; let mut stuck = false; for row in grid.iter() { @@ -16,7 +16,7 @@ fn find_ball(grid: Vec>) -> Vec { if !stuck { res[ball] = pos as i32; } - } + }); res }