Skip to content

Commit 12fd617

Browse files
Add files via upload
1 parent eaa4d10 commit 12fd617

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Histogram.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
class stack:
2+
data = []
3+
def __init__(self): # Constructor
4+
data = [] # list - instance vaiable
5+
self.top = -1 # top - instance variable
6+
7+
def size(self): # getter funciton - size
8+
return len(self.data) # length - of data
9+
10+
def peek(self):
11+
return self.data(self.top)
12+
def push(self,item):
13+
self.data.append(item)
14+
self.top += 1
15+
def pop(self):
16+
rev = self.data.pop(self.top)
17+
self.top -= 1
18+
return rev
19+
def isEmpty(self):
20+
return len(self.data) == 0
21+
def display(self):
22+
print(self.data)
23+
24+
n = int(input())
25+
s = stack()
26+
a=[]
27+
for i in range(0, n):
28+
a.append(int(input()))
29+
30+
var ,ans, mx, i = 0, 0, 0, 0
31+
32+
while i < len(a):
33+
34+
if s.isEmpty() or

0 commit comments

Comments
 (0)