MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / push

Method push

python/0225-implement-stack-using-queues.py:5–9  ·  view source on GitHub ↗
(self, x: int)

Source from the content-addressed store, hash-verified

3 self.q = deque()
4
5 def push(self, x: int) -> None:
6 self.q.append(x)
7
8 for _ in range(len(self.q) - 1):
9 self.q.append(self.q.popleft())
10
11 def pop(self) -> int:
12 return self.q.popleft()

Callers

nothing calls this directly

Calls 1

popleftMethod · 0.80

Tested by

no test coverage detected