-
[hackerrank] Marc's Cakewalk python공부/알고리즘 2021. 9. 10. 03:28
1. calorie reverse sort해주고 관련 수식을 mileSum에 더해주자
def marcsCakewalk(calorie): # Write your code here calorie.sort(reverse=True) mileSum = 0 for index, cal in enumerate(calorie): mileSum += (2**index * cal) return mileSum
728x90'공부 > 알고리즘' 카테고리의 다른 글
[hackerrank] Candies python (0) 2021.09.10 [hackerrank] Maximum Perimeter Triangle python (0) 2021.09.10 [hackerrank] Grid Challenge python (0) 2021.09.10 [hackerrank] Minimum Absolute Difference python (0) 2021.09.09 [python] Codility Lesson 9-3. MaxDoubleSliceSum (0) 2021.09.09