On mut semantic for ownership

I’ve just solved a problem at Leetcode with following signature:

pub fn num_islands(grid: Vec<Vec<char>>) -> i32

When I solved it I changed it to:

pub fn num_islands(mut grid: Vec<Vec<char>>) -> i32 {
journey to rust
journey to rust
Side notes on learning Rust language
More information
Followers
581
Elsewhere