rewrite leetcode largest rectangle in histogram