Created
September 16, 2023 13:36
-
-
Save codeperfectplus/2712c2f22e66270ff7ab3a4d73f3dbc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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