➽ Problem:-
https://www.hackerrank.com/challenges/birthday-cake-candles/problem
➽ Solution:-
#include<iostream>
using namespace
std;
int main()
{
int N;
cin>>N;
int arr[N];
for(int i=0;i<N;i++)
{
cin>>arr[i];
}
int height=0,count=0;
for(int i=0;i<N;i++)
{
if(arr[i]>height)
{
height = arr[i];
count = 1;
}
else if(arr[i] == height)
{
count++;
}
}
cout<<count<<endl;
return 0;
}
0 Comments
Please do not enter any spam link in the comment section.