You are viewing a single comment's thread. Return to all comments →
Python 3 using list comprehension:
import os def birthdayCakeCandles(candles): tallest_candle = max(candles) num_tallest = sum([c == tallest_candle for c in candles]) return num_tallest if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') candles_count = int(input().strip()) candles = list(map(int, input().rstrip().split())) result = birthdayCakeCandles(candles) fptr.write(str(result) + '\n') fptr.close()
Seems like cookies are disabled on this browser, please enable them to open this website
Birthday Cake Candles
You are viewing a single comment's thread. Return to all comments →
Python 3 using list comprehension: