Pergunta de entrevista da empresa Yodlee

Find the max element in a stack at any given point of time

Resposta da entrevista

Sigiloso

21 de jan. de 2018

I wrote a function which used a temp stack, while popping the element out from the given stack I was checking the max value and pushing the value in temp stack,at last I have max element and to maintain the stacks order I pushed back the elements from the temp stack to the given stack