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.
I did roughly the same (in C++). Note that you can avoid to write the final loop (to empty the stack) if you append a 0 to the list of heights at the very beginning. (That 0 height will trigger the same loop.)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Largest Rectangle
You are viewing a single comment's thread. Return to all comments →
I did roughly the same (in C++). Note that you can avoid to write the final loop (to empty the stack) if you append a 0 to the list of heights at the very beginning. (That 0 height will trigger the same loop.)