Skip to content

Commit 2bedc2f

Browse files
committed
add 002. Marc's Cakewalk
1 parent 92cf30f commit 2bedc2f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Problem: https://www.hackerrank.com/challenges/marcs-cakewalk/problem
2+
# Score: 15
3+
4+
5+
_ = input()
6+
calories = list(map(int, input().split()))
7+
calories = sorted(calories, reverse=True)
8+
ans = 0
9+
for index, cupcake in enumerate(calories):
10+
ans += 2**index*cupcake
11+
print(ans)

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Welcome to HackerrankPractice repo on GitHub](http://www.picshare.ru/uploads/180620/mx1ziVEugO.jpg)](https://youtu.be/RGE2GC8OCgk)
44

55
# Solutions to Hackerrank practice problems
6-
This repository contains 135 solutions to Hackerrank practice problems with Python 3 and Oracle SQL.
6+
This repository contains 137 solutions to Hackerrank practice problems with Python 3 and Oracle SQL.
77

88
Updated daily :) If it was helpful please press a star.
99

@@ -44,13 +44,17 @@ Updated daily :) If it was helpful please press a star.
4444
- Pairs | [Problem](https://www.hackerrank.com/challenges/pairs/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Algorithms/05.%20Search/007.%20Pairs.py) | Score: 50
4545
07. Greedy
4646
- Minimum Absolute Difference in an Array | [Problem](https://www.hackerrank.com/challenges/minimum-absolute-difference-in-an-array/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Algorithms/07.%20Greedy/001.%20Minimum%20Absolute%20Difference%20in%20an%20Array.py) | Score: 15
47+
- Marc's Cakewalk | [Problem](https://www.hackerrank.com/challenges/marcs-cakewalk/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Algorithms/07.%20Greedy/002.%20Marc's%20Cakewalk.py) | Score: 15
4748
- Permuting Two Arrays | [Problem](https://www.hackerrank.com/challenges/two-arrays/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Algorithms/07.%20Greedy/014.%20Permuting%20Two%20Arrays.py) | Score: 40
4849
08. Dynamic Programming
4950
- The Coin Change Problem | [Problem](https://www.hackerrank.com/challenges/coin-change/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Algorithms/08.%20Dynamic%20Programming/001.%20The%20Coin%20Change%20Problem.py) | Score: 60
5051
- Equal | [Problem](https://www.hackerrank.com/challenges/equal/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Algorithms/08.%20Dynamic%20Programming/002.%20Equal.py) | Score: 30
5152
- Sherlock and Cost | [Problem](https://www.hackerrank.com/challenges/sherlock-and-cost/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Algorithms/08.%20Dynamic%20Programming/003.%20Sherlock%20and%20Cost.py) | Score: 50
5253
- Construct the Array | [Problem](https://www.hackerrank.com/challenges/construct-the-array/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Algorithms/08.%20Dynamic%20Programming/004.%20Construct%20the%20Array.py) | Score: 35
5354
- Fibonacci Modified | [Problem](https://www.hackerrank.com/challenges/fibonacci-modified/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Algorithms/08.%20Dynamic%20Programming/008.%20Fibonacci%20Modified.py) | Score: 45
55+
- Artificial Intelligence
56+
Statistics and Machine Learning
57+
- Laptop Battery Life | [Problem](https://www.hackerrank.com/challenges/battery/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Artificial%20Intelligence/Statistics%20and%20Machine%20Learning/001.%20Laptop%20Battery%20Life.py) | Score: 10
5458
- Data Structures
5559
01. Arrays
5660
- Arrays - DS | [Problem](https://www.hackerrank.com/challenges/arrays-ds/problem) | [Solution](https://github.com/marinskiy/HackerrankPractice/blob/master/Data%20Structures/01.%20Arrays/001.%20Arrays%20-%20DS.py) | Score: 10

0 commit comments

Comments
 (0)