Problema
Ver traduçãoLook at every decimal digit of n and return the smallest one. Zeros inside the number count.
Implement smallest_digit(n).
Input
n: A positive integer.
Output
Return the smallest digit, from 0 to 9.
Restrições
1 ≤ n ≤ 10¹⁸
Exemplos
Exemplo 1
Entrada:
n = 352
Saída esperada:
expected = 2
Entrada:
long long n = 352;
Saída esperada:
long long expected = 2;
Entrada:
long n = 352;
Saída esperada:
long expected = 2;
Explicação
The digits are 3, 5 and 2; the smallest is 2.
Exemplo 2
Entrada:
n = 1203
Saída esperada:
expected = 0
Entrada:
long long n = 1203;
Saída esperada:
long long expected = 0;
Entrada:
long n = 1203;
Saída esperada:
long expected = 0;
Explicação
The 0 inside the number is the smallest digit.