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.
Phew, so finally solved this after weeks. It basically comes down to idea of min_queue problem. i.e, you can look up minimum of 'M' consecutive terms as you move from left to right in an array in O(1).
Two stacks!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Billboards
You are viewing a single comment's thread. Return to all comments →
Phew, so finally solved this after weeks. It basically comes down to idea of min_queue problem. i.e, you can look up minimum of 'M' consecutive terms as you move from left to right in an array in O(1).
Two stacks!