You are viewing a single comment's thread. Return to all comments →
From my HackerRank solutions.
Stack<Character> stack = new Stack<>(); Queue<Character> queue = new LinkedList<>(); void pushCharacter(char ch) { stack.push(ch); } void enqueueCharacter(char ch) { queue.add(ch); } char popCharacter() { return stack.pop(); } char dequeueCharacter() { return queue.remove(); }
Let me know if you have any questions.
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 →
Java solution - passes 100% of test cases
From my HackerRank solutions.
Let me know if you have any questions.