Skip to content

Instantly share code, notes, and snippets.

@codeperfectplus
Created September 16, 2023 13:36
Show Gist options
  • Save codeperfectplus/2712c2f22e66270ff7ab3a4d73f3dbc9 to your computer and use it in GitHub Desktop.
Save codeperfectplus/2712c2f22e66270ff7ab3a4d73f3dbc9 to your computer and use it in GitHub Desktop.
int birthdayCakeCandles(vector<int> ar) {
int max = ar[0];
int count = 0;
int n = ar.size();
for(int i=0;i<n; i++) {
if(ar[i] > max) {
max = ar[i];
}
}
for (int i=0;i<n;i++) {
if(ar[i]==max) {
count++;
}
}
return count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment