My program ignores me 0 on the left, example pass 001 and take it as 1 and I need everything complete.
My code goes like this
function rotate_to_max($n): int {
echo "El numero inicial es ".$n."\n";
$vec = array();
while($n != 0){
$vec[] = $n%10;
$n = (integer)($n/10);
}
rsort($vec);
return implode($vec);
}
And when I get numbers like 000001, I ignore 0 and it's not what I want.
What does my code order me from highest to lowest number passed, then 001 I take it as 1 and I need 001 to take it as 100 equal with another number that pass, example: 00145 = > 54100 and it does is 00145 = > 541, then 541! = 54100