Question d’entretien chez SpaceX

How do you reverse a stack, using only the pop and push methods?

Réponse à la question d'entretien

Utilisateur anonyme

13 oct. 2017

In Java: public Stack reverse(Stack input){ Stack output = new Stack(); while(!input.isEmpty()) output.push(input.pop()); return output; }