prepross input and conver the problem to compute largest rectangle in n histograms