Problema
Mostra traduzioneLook 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.
Vincoli
1 ≤ n ≤ 10¹⁸
Esempi
Esempio 1
Input:
n = 352
Output atteso:
expected = 2
Input:
long long n = 352;
Output atteso:
long long expected = 2;
Input:
long n = 352;
Output atteso:
long expected = 2;
Spiegazione
The digits are 3, 5 and 2; the smallest is 2.
Esempio 2
Input:
n = 1203
Output atteso:
expected = 0
Input:
long long n = 1203;
Output atteso:
long long expected = 0;
Input:
long n = 1203;
Output atteso:
long expected = 0;
Spiegazione
The 0 inside the number is the smallest digit.