➽ Problem:-
https://www.hackerrank.com/challenges/birthday-cake-candles/problem
➽ Solution:-
#include<stdio.h>
int main()
{
int N;
scanf("%d", &N);
int arr[N];
for(int i=0;i<N;i++)
{
scanf("%d", &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++;
}
}
printf("%d",count);
return 0;
}
0 Comments
Please do not enter any spam link in the comment section.