Created
May 13, 2021 06:50
-
-
Save NimaGhaedsharafi/136d3f13a677586158b139e66bf8c6d2 to your computer and use it in GitHub Desktop.
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
<? | |
function num($data, $i) | |
{ | |
$c = strlen($data); | |
if ($c == 2 && $data > 26) { | |
return 0; | |
} | |
if ($c < 3) { | |
return $c; | |
} | |
return num(substr($data,0, 1), $i+1) + num(substr($data, 1), $i+1) + num(substr($data,0, 2), $i+1) + num(substr($data,2), $i+1); | |
} | |
echo num("1224", 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment