You are viewing a single comment's thread. Return to all comments →
JS
function Solution() { this.stack = new Array(); this.queue = new Array(); this.pushCharacter = function (s) { this.stack.push(s); }; this.enqueueCharacter = function (s) { this.queue.push(s); }; this.popCharacter = function () { return this.stack.pop(); }; this.dequeueCharacter = function () { return this.queue.shift(); }; }
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 →
JS