Problème
Afficher la traductionLook 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.
Contraintes
1 ≤ n ≤ 10¹⁸
Exemples
Exemple 1
Entrée :
n = 352
Sortie attendue :
expected = 2
Entrée :
long long n = 352;
Sortie attendue :
long long expected = 2;
Entrée :
long n = 352;
Sortie attendue :
long expected = 2;
Explication
The digits are 3, 5 and 2; the smallest is 2.
Exemple 2
Entrée :
n = 1203
Sortie attendue :
expected = 0
Entrée :
long long n = 1203;
Sortie attendue :
long long expected = 0;
Entrée :
long n = 1203;
Sortie attendue :
long expected = 0;
Explication
The 0 inside the number is the smallest digit.