/** Initialize your data structure here. */ funcConstructor() MyQueue { return MyQueue{} }
/** Push element x to the back of queue. */ func(this *MyQueue) Push(x int) { this.i = append(this.i, x) }
/** Removes the element from in front of queue and returns that element. */ func(this *MyQueue) Pop() int { ret := this.Peek() this.o = this.o[:len(this.o) - 1] return ret }
/** Get the front element. */ func(this *MyQueue) Peek() int { iflen(this.o) == 0 { forlen(this.i) > 0 { this.o = append(this.o, this.i[len(this.i) - 1]) this.i = this.i[:len(this.i) - 1] } } return this.o[len(this.o) - 1] }