आसान 0 हल किए गए 0% स्वीकृति

Smallest Digit

Find the smallest decimal digit of a positive integer.

Look 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.

सीमाएँ

1 ≤ n ≤ 10¹⁸

उदाहरण

उदाहरण 1
इनपुट:
n = 352

अपेक्षित आउटपुट:
expected = 2
इनपुट:
long long n = 352;

अपेक्षित आउटपुट:
long long expected = 2;
इनपुट:
long n = 352;

अपेक्षित आउटपुट:
long expected = 2;

व्याख्या

The digits are 3, 5 and 2; the smallest is 2.

उदाहरण 2
इनपुट:
n = 1203

अपेक्षित आउटपुट:
expected = 0
इनपुट:
long long n = 1203;

अपेक्षित आउटपुट:
long long expected = 0;
इनपुट:
long n = 1203;

अपेक्षित आउटपुट:
long expected = 0;

व्याख्या

The 0 inside the number is the smallest digit.

दूसरों से सीखें

समुदाय समाधान

अभी तक कोई प्रकाशित समाधान नहीं। पहला साझा करने के लिए इस चुनौती को हल करें।