Sollicitatievraag bij Microsoft

Implement stack that holds minimum

Antwoord op sollicitatievraag

Anoniem

1 feb 2019

Stack has global minimum, each node has minimum. Whenever you push node, nodes minimum = stacks global minimum. That way when you pop, the stacks global minimum = min(top node min, stack min)