You are viewing a single comment's thread. Return to all comments →
Yeah, yours is way cleaner than mine
int birthdayCakeCandles(int n, vector <int> ar) { int count = 1; sort(ar.begin(), ar.end()); reverse(ar.begin(), ar.end()); for (int i = 0; i < n; i++){ if (ar[i] == ar[i+1]){ count++; } else break; } return count; }
Birthday Cake Candles
You are viewing a single comment's thread. Return to all comments →
Yeah, yours is way cleaner than mine