2
pub fn largest_rectangle_area(heights: Vec<i32>) -> i32 {3
let mut hs = heights.clone();7
fn bounds(hs: &Vec<i32>) -> Vec<usize> {8
let mut left = vec![0; hs.len()];10
left[i] = if hs[i] > hs[i - 1] {12
} else if hs[i] == hs[i - 1] {15
let mut j = left[i - 1];16
while j >= 0 && hs[j] >= hs[i] && j != left[j] {24
let rs: Vec<i32> = hs.clone().into_iter().rev().collect();25
let bounds_l = bounds(&hs);26
let bounds_r: Vec<usize> = bounds(&rs)29
.map(|i| hs.len() - 1 - i)35
.map(|(i, (l, r))| (r - l - 1) * hs[i] as usize)