GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — AlgorithmNuggets/ProblemSolving/minStack/min2.py at master · srixivas/AlgorithmNuggets Expand file tree/ Copy pathmin2.pyMore file actions 44 lines (34 loc) · 761 Bytes / Copy pathmin2.pyFile metadata and controls44 lines (34 loc) · 761 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 class MinStack(object): def __init__(self): """ initialize your data structure here. """ self.stack = [] self.min = -float('inf') def push(self, x): """ :type x: int :rtype: None """ self.stack.append(x) def pop(self): """ :rtype: None """ self.stack.pop() def top(self): """ :rtype: int """ return self.stack[-1] def getMin(self): """ :rtype: int """ return min(self.stack) # Your MinStack object will be instantiated and called as such: # obj = MinStack() # obj.push(x) # obj.pop() # param_3 = obj.top() # param_4 = obj.getMin() |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |