cpp implementation of Largest Rectangle in Histogram