Created
February 26, 2020 18:57
-
-
Save torressam333/3b7cb67cc30a07374bc29b38eefd0fdf to your computer and use it in GitHub Desktop.
Hackerrank Birthday Cake Candles
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
<?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