Write a minPeak function for a stack (function that returns the minimum element in the stack).
Anoniem
Push on the previous lowest and update your own lowest. So insert a 4, now we have on the stack (4:nothing) and lowest is 4. Now insert a 7 - (4:Nothing), (7:4). Now insert a 3 -> (4:Nothing), (7:4), (3:4) and lowest is 3. Now insert a 9 -> (4:Nothing), (7:4), (3:4), (9:3). Now pop -> lowest is still 3 and stack is (4:Nothing), (7:4), (3:4) etc. When you push, you push on the previous lowest at the same spot, and when you pop, you update your lowest to the top of the stack's low.