Aktiver Arbeitgeber
Find the maximum value in a stack, with constant complexity
Anonym
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.
Verschaffe dir einen Vorsprung bei Chancen und Insider-Tipps, indem du deinem Traumunternehmen folgst.
Erhalte personalisierte Jobempfehlungen und Updates, indem du Suchanfragen startest.