This question has already been discussed in depth previously: There are 2 ways to do this: 1. Using 4 stacks (actually 2 min stacks) 2. Using a queue and a deque
A highly detailed, easy to understand discussion of the problem has already taken place in the group previously: The complete discussion thread: https://groups.google.com/d/topic/algogeeks/NxFXQjSN7bo/discussion My Solution for the problem (with additional bonus results) as a method that hasn't been posted anywhere else on the web: https://groups.google.com/d/msg/algogeeks/NxFXQjSN7bo/iHm62yEZOgcJ -- DK http://gplus.to/divyekapoor http://www.divye.in http://twitter.com/divyekapoor -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/MD71295a09EJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
