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.
brilliant. Every element stored represents the max Number for ALL the elements stored before it. If the top item is poped its guaranteed the next top element represents the appropriate max number of the collection. So this is why Stack was chosen for the problem...lol oh man my solution was way off and didn't even use that basic fundamental of a stack.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Maximum Element
You are viewing a single comment's thread. Return to all comments →
brilliant. Every element stored represents the max Number for ALL the elements stored before it. If the top item is poped its guaranteed the next top element represents the appropriate max number of the collection. So this is why Stack was chosen for the problem...lol oh man my solution was way off and didn't even use that basic fundamental of a stack.