Skip to content

Commit 81f7984

Browse files
committed
Add new solutions to problems in Algorithms - Warmup
1 parent 9f194bf commit 81f7984

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ I felt guilty for those who had watched and starred my repository. Thus, I'm try
66

77
|Domain|Status|Last Updated|
88
|---|---|---|
9-
|[Algorithms - Warmup](domains/algorithms/warmup/README.md)|9 / 9|1/21/2017|
9+
|[Algorithms - Warmup](domains/algorithms/warmup/README.md)|10 / 10|4/3/2017|
1010
|[Algorithms - Implementation](domains/algorithms/implementation/README.md)|42 / 48|2/6/2017|
1111
|*Algorithms - Constructive Algorithms*|||
1212
|*Algorithms - Strings*|||

‎domains/algorithms/warmup/README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
This repository keeps a list of the problems in [Algorithms - Warmup](https://www.hackerrank.com/domains/algorithms/warmup). The threshold I'm currently using is 10 minute for each easy problem.
44

5-
## Submissions (9 / 9)
5+
## Submissions (10 / 10)
6+
67
|Problem|Solution|Difficulty|Date|Time|#Sub|Comment|
78
|---|---|---|---|---|---|---|
89
|[Solve Me First](https://www.hackerrank.com/challenges/solve-me-first)|[solve-me-first.cpp](solve-me-first.cpp)|Easy|1/21/2017|0'29"|1||
@@ -12,5 +13,6 @@ This repository keeps a list of the problems in [Algorithms - Warmup](https://ww
1213
|[Diagonal Difference](https://www.hackerrank.com/challenges/diagonal-difference)|[diagonal-difference.cpp](diagonal-difference.cpp)|Easy|1/21/2017|2'27"|1||
1314
|[Plus Minus](https://www.hackerrank.com/challenges/plus-minus)|[plus-minus.cpp](plus-minus.cpp)|Easy|1/21/2017|2'05"|1||
1415
|[Staircase](https://www.hackerrank.com/challenges/staircase)|[staircase.cpp](staircase.cpp)|Easy|1/21/2017|1'29"|1||
16+
|[Mini-Max Sum](https://www.hackerrank.com/challenges/mini-max-sum)|[mini-max-sum.cpp](mini-max-sum.cpp)|Easy|1/22/2017|1'53"|1||
1517
|[Time Conversion](https://www.hackerrank.com/challenges/time-conversion)|[time-conversion.cpp](time-conversion.cpp)|Easy|1/21/2017|4'07"|1||
16-
|[Circular Array Rotation](https://www.hackerrank.com/challenges/circular-array-rotation)|[circular-array-rotation.cpp](circular-array-rotation.cpp)|Easy|1/21/2017|3'18"|1||
18+
|[Birthday Cake Candles](https://www.hackerrank.com/challenges/birthday-cake-candles)|birthday-cake-candles.cpp|Easy|4/3/2017|1'46"|1||
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
birthday-cake-candles.cpp
3+
Birthday Cake Candles
4+
*/
5+
6+
#include <iostream>
7+
using namespace std;
8+
9+
int main() {
10+
int n;
11+
cin >> n;
12+
int maxVal = 0, ans = 0;
13+
for (int i = 0; i < n; i++) {
14+
int height;
15+
cin >> height;
16+
if (height > maxVal) {
17+
maxVal = height;
18+
ans = 1;
19+
} else if (height == maxVal) {
20+
ans++;
21+
}
22+
}
23+
cout << ans << endl;
24+
return 0;
25+
}

0 commit comments

Comments
 (0)