You are viewing a single comment's thread. Return to all comments →
n = int(input().strip())
ar = (list(map(int, input().strip().split(' '))))
Thank you! I hadn't realized Python had a count method for lists that basically reduces the problem to 1 step.
what is the code of "count" function?? bcos when I am using loop instead of count fuction, its taking too much time to run. pls help??
I am using loop but it is the same thing with ar.count(max(ar))
def birthdayCakeCandles(n, ar):
for x in range(n):
for y in range(n):
if ar[y] == max_height: