Write the Java code for a stack that implements pop(), push(), peek(), offer(), etc and gets the maximum value in constant time.
Anonymous
Use LinkedList (this was an acceptable way) for most operations and have a separate LinkedList to keep track of the maximum element, adding the maximum at time of the insert to it.
Check out your Company Bowl for anonymous work chats.