MCPcopy
hub / github.com/careercup/ctci / push

Method push

python/Chapter 3/Question3_2/ChapQ3.2.py:7–11  ·  view source on GitHub ↗
(self, value)

Source from the content-addressed store, hash-verified

5 def empty(self):
6 return len(self.storage) == 0
7 def push(self, value):
8 if len(self.storage) == 0 or value < self.storage[-1][1]:
9 self.storage.append((value, value))
10 else:
11 self.storage.append((value, self.storage[-1][1]))
12 def pop(self):
13 return self.storage.pop()[0]
14 def get_top(self):

Callers 1

ChapQ3.2.pyFile · 0.45

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected