We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Heights are not cumulatively increasing, that would make the problem so much easier, and yes, a stack could be used in that case. I took a look at test#2 and this is the input:
Largest Rectangle
You are viewing a single comment's thread. Return to all comments →
Heights are not cumulatively increasing, that would make the problem so much easier, and yes, a stack could be used in that case. I took a look at test#2 and this is the input:
10 6320 6020 6098 1332 7263 672 9472 28338 3401 9494
output:18060 (from adding the first three numbers)
I also looked at another test, and the rectangle can be in the middle, it doesn't neccessarily have to be on the extremes.