Skip to content

Instantly share code, notes, and snippets.

@torressam333
Created February 26, 2020 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torressam333/3b7cb67cc30a07374bc29b38eefd0fdf to your computer and use it in GitHub Desktop.
Save torressam333/3b7cb67cc30a07374bc29b38eefd0fdf to your computer and use it in GitHub Desktop.
Hackerrank Birthday Cake Candles
<?php
// Complete the birthdayCakeCandles function below.
function birthdayCakeCandles($ar) {
//Count occurrance of each value in array
$candleCount = array_count_values($ar);
//This is the single higest value in the array
$tallestCandleCount = max($candleCount);
//Return how many times the single higest value occurs in array
return $tallestCandleCount;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment