Actieve werkgever
Find the maximum value in a stack, with constant complexity
Anoniem
It's easy to keep track of the highest value when you do push. But it gets tricky when you do pop. You may need two stacks to keep track of it.
@Jun: Where is the constant complexity?? You gonna push and pop every element or do you have any specific algo :P
keep track of the highest value when you do a pop and push into the stack. simple.
Volg de bedrijven van je dromen om als eerste op de hoogte te zijn van vacatures en te profiteren van tips van insiders.
Zoek naar vacatures om gepersonaliseerde vacature-aanbevelingen en -updates te krijgen.