Pregunta de entrevista de Indeed

How to find the minimum value in a stack with constant time complexity?

Respuesta de la entrevista

Anónimo

17 sep 2015

Keep track of the minimum value in a second stack/variable when you push. This way minimum value is always at hand.