Skip to content

Commit 3beed5b

Browse files
authored
225. Implement Stack using Queues fix
Notice that your pop() is doing: self.q_.pop() # just pops but doesn't return anything But the problem expects you to: return the popped element (the element that was on the top of the stack)
1 parent 03f0223 commit 3beed5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/implement-stack-using-queues.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def pop(self):
6868
for _ in xrange(self.q_.size() - 1):
6969
self.top_ = self.q_.pop()
7070
self.q_.push(self.top_)
71-
self.q_.pop()
71+
return self.q_.pop()
7272

7373
# @return an integer
7474
def top(self):

0 commit comments

Comments
 (0)