2
pub fn max_height(cuboids: Vec<Vec<i32>>) -> i32 {6
let mut cuboids = cuboids11
(cub[0], cub[1], cub[2])16
cuboids.sort_by(|(x1, y1, z1), (x2, y2, z2)| {17
// -- prevent wrong formatting18
if x1 < x2 && y1 < y2 && z1 < z2 {25
let mut ans = vec![(0, 0, 0); m];26
// walk through every pair since n size is only 100 and try27
// to maximize stack in each position29
for (i, (x, y, z)) in cuboids.into_iter().skip(1).enumerate() {32
if prev.1 >= y && prev.2 >= z {33
ans[i + 1] = ans[i + 1].max((x + prev.0, y, z));35
ans[i + 1] = ans[i + 1].max((x, y, z));40
ans.into_iter().map(|(x, _, _)| x).max().unwrap()