class QueueStack { constructor() { this.q = []; } push(val) { let size = this.q.length; this.q.push(val); while (size--) { this.q.push(this.q.shift()); } } pop() { if (!this.q.length) return null; return this.q.shift(); } peek() { if (!this.q.length) return null; return this.q[0]; } isEmpty() { return this.q.length === 0 } }