Instructions
-
Task
Given an integer
n
, find the maximal number you can obtain by deleting exactly one digit of the given number.Example
For
n = 152
, the output should be52
;For
n = 1001
, the output should be101
.Input/Output
-
[input]
integern
Constraints:
10 ≤ n ≤ 1000000.
[output]
an integer
function deleteDigit($n){ $arr = str_split($n); $len = count($arr); $array = []; for($i=0;$i<$len;$i++){ $arrs= $arr; unset($arrs[$i]); $data[] = $arrs; array_push($array,implode("",$data[$i])); } return max($array); }
-