Rust 0ms 🔥 2.15Mb ☄️ One Function Solution 🦀
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\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(1)$$\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        fn dfs(v: &mut Vec<Vec<i32>>, i: usize, j: usize) -> i32 {\n            if i>=v.len() || j>=v[0].len() || v[i][j] == 0 {return 0;}\n            let x = v[i][j];\n            v[i][j] = 0;\n            x + dfs(v, i+1, j) + dfs(v, i, j+1)\n            + dfs(v, i.saturating_sub(1), j)\n            + dfs(v, i, j.saturating_sub(1))\n        }\n\n        (0..grid.len())\n        .map(|i| {\n            (0..grid[0].len())\n            .map(|j| {\n                dfs(&mut grid, i, j)\n            })\n            .max()\n            .unwrap()    \n        })\n        .max()\n        .unwrap()\n    }\n}\n```
['Rust']