You are viewing a single comment's thread. Return to all comments →
Here is my solution :
Stack<Character> stack = new Stack<>(); Queue<Character> queue = new LinkedList<>(); void pushCharacter(Character ch) { stack.push(ch); } void enqueueCharacter(char ch) { queue.add(ch); } char popCharacter(){ return stack.pop(); } char dequeueCharacter() { return queue.remove(); }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 18: Queues and Stacks
You are viewing a single comment's thread. Return to all comments →
Here is my solution :