Question d’entretien chez IDFC FIRST Bank

How can you convert a stack into a queue.

Réponse à la question d'entretien

Utilisateur anonyme

14 janv. 2025

You can use a single stack with recursion to reverse the order. Steps: Push elements onto the stack. When dequeueing: Pop all elements except the last one using recursion. Return the last element (FIFO behavior).