Easy DFS Solution | O(n) | Rust
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nimpl Solution {\n    pub fn find_max_fish(mut grid: Vec<Vec<i32>>) -> i32 {\n        let mut ans = 0;\n\n        for i in 0..grid.len() {\n            for j in 0..grid[0].len() {\n                if grid[i][j] > 0 {\n                    ans = ans.max(dfs(&mut grid, i, j));\n                }\n            }\n        }\n        \n        ans\n    }\n}\n\nfn dfs(grid: &mut Vec<Vec<i32>>, i: usize, j: usize) -> i32 {\n    if i >= grid.len() || j >= grid[0].len() || grid[i][j] == 0 { return 0 };\n    let val = grid[i][j];\n    grid[i][j] = 0;\n\n    dfs(grid, i + 1, j) +\n    dfs(grid, i - 1, j) +\n    dfs(grid, i, j + 1) +\n    dfs(grid, i, j - 1) + val\n}\n```
['Rust']