This is a solution to Hackerrank's algorithm problem
Implementation of the same problem in C++ is as following.
#include
#include
#include
#include
#include
using namespace std;
int main() {
int age_n;
std::vector candles_n;
int input;
cin>>age_n;
while(cin >> input)
candles_n.push_back(input);
int largest_height = *std::max_element(candles_n.begin(), candles_n.end());
int mycount = std::count (candles_n.begin(), candles_n.end(), largest_height);
cout << mycount;
return 0;
}
Comments
Post a Comment