You are viewing a single comment's thread. Return to all comments →
My solution in c++, hope to help you
#include <iostream> #include <stack> #include <queue> using namespace std; class Solution { //Write your code here stack<char> s; queue<char> q; public: void pushCharacter(char i) { s.push(i); } void enqueueCharacter(char i) { q.push(i); } char popCharacter() { char temp = s.top(); s.pop(); return temp; } char dequeueCharacter() { char temp = q.front(); q.pop(); return temp; } };
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 →
My solution in c++, hope to help you