✅ [Rust] 0 ms, functional-style efficient sliding windows (with detailed comments)
This solution employs a functional-style approach with sliding windows to first compute maximum values for triples across rows, then across columns. It demonstr
This [solution](https://leetcode.com/submissions/detail/796636578/) employs a functional-style approach with sliding windows to first compute maximum values for triples across rows, then across columns. It demonstrated **0 ms runtime (100%)** and used **2.2 MB memory (66.34%)**. Detailed comments are provided.\n\n**IF YOU LIKE THIS SOLUTION, PLEASE UPVOTE.**\n```\nuse std::cmp::max;\n\nimpl Solution \n{\n    pub fn largest_local(grid: Vec<Vec<i32>>) -> Vec<Vec<i32>> \n    {\n        // [1] first, we compute maximum values across\n        //     3-windows in each row\n        let max_rows: Vec<Vec<i32>> = \n            grid\n                .iter()\n                .map(|v| \n                      v.windows(3)\n                       .map(|w| *w.iter().max().unwrap())\n                       .collect()\n                ).collect();\n\n        // [2] second, we compute maximum values across\n        //     3-windows in each column;\n        max_rows\n            .windows(3)\n            .map(|w: &[Vec<i32>]| \n        // [3] to scan columns in a 3-row slice, we zip 3 iterators...\n                  w[0].iter()\n                      .zip(w[1].iter())\n                      .zip(w[2].iter())\n        // [4] ...and compute maximum across each column\n                      .map(|((a,b),c)| max(max(*a,*b),*c))\n                      .collect()\n            ).collect()\n    } \n}\n```
['Rust']