Created
May 18, 2020 06:05
-
-
Save lysShub/d313e16861e6e97deed686e15a4e60f2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* @param Integer $N | |
* @return Integer | |
*/ | |
function getRepeatDigital( $N ){ | |
$N = (string)$N ; | |
$dList = str_split( $N, 1); | |
for ($i=0; $i < strlen($N); $i++) { | |
$nowD = $dList[$i]; | |
$计数 = 1; | |
for ($j=$i+1; $j < strlen($N); $j++) { | |
if( $dList[$j]==$nowD ){ $计数 = $计数 + 1; } | |
} | |
$dList[$i] = $计数; | |
} | |
return max( $dList ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment