simplfy check every previous square, O(n^2)
\n\nimpl Solution {\n    pub fn falling_squares(xs: Vec<Vec<i32>>) -> Vec<i32> {\n        let n = xs.len();\n        let mut h = vec![0; n];\n        let mut hh
\n```\nimpl Solution {\n    pub fn falling_squares(xs: Vec<Vec<i32>>) -> Vec<i32> {\n        let n = xs.len();\n        let mut h = vec![0; n];\n        let mut hh = 0; \n        let mut r = Vec::with_capacity(n);\n        hh = 0;\n        for i in 0..n {\n            let x = xs[i][0];\n            let s = xs[i][1];\n            for j in 0..i {\n                let y = xs[j][0];\n                let z = xs[j][1];\n                if (y <= x  && x < y + z)  ||  (y < x + s  && x + s <= y + z) \n                |  (x <= y  && y < x + s)  ||  (x < y + z  && y + z <= x + s) {\n                    h[i] = h[i].max(h[j])\n                }\n            }\n            h[i] += s;\n            hh = hh.max(h[i]);\n            r.push(hh)\n        }\n        r\n    }\n}\n```
['Rust']