Skip to content

Instantly share code, notes, and snippets.

@lysShub
Created May 18, 2020 06:05
Show Gist options
  • Save lysShub/d313e16861e6e97deed686e15a4e60f2 to your computer and use it in GitHub Desktop.
Save lysShub/d313e16861e6e97deed686e15a4e60f2 to your computer and use it in GitHub Desktop.
/**
* @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