
# Complete the birthdayCakeCandles function below.
def birthdayCakeCandles(ar):
max_ = max(ar)
survived_candles = [v for v in ar if v == max_]
return len(survived_candles)
if __name__ == '__main__':
ar_count = int(input())
ar = list(map(int, input().rstrip().split()))
result = birthdayCakeCandles(ar)
print(result)
def max_candles_count(num, candles_height):
if num != len(candles_height):
return '개수가 틀립니다.'
max_height = max(candles_height)
return len([i for i in candles_height if i == max_height])
if __name__ == '__main__':
num = int(input())
candles_height = list(map(int, input().split()))
result = max_candles_count(num, candles_height)
print(result)
'HackerRank Algorithm' 카테고리의 다른 글
[HackerRank] 23. Apple and orange (0) | 2020.04.07 |
---|---|
[HackerRank] 22. Between Two Sets (0) | 2020.04.07 |
[HackerRank] 20. Birthday chocolate (0) | 2020.04.01 |
[HackerRank] 19. Bon Appétit (0) | 2020.04.01 |
[HackerRank] 18. Breaking the Records (0) | 2020.04.01 |
댓글