Implement Stack using Queues

這題是使用隊列去實現棧,屬於比較基礎的題目。須要考慮的點在於隊列爲先進先出,即入隊在隊尾,可是出隊在隊首,而棧爲先進後出,即出棧和入棧都在棧尾。須要實現的功能以下:html push(x) -- Push element x onto stack.python pop() -- Removes the element on top of the stack.app top() -- Get the
相關文章
相關標籤/搜索