largest rectangle in hisogram: merge into one loop