970. Maximum and Minimum Digit in a Number
Given a non-negative integer N, return an array of two integers, where:
- The first element is the smallest digit in the number.
- The second element is the largest digit in the number.
Example 1:
Input:Â 2746
Output: [2, 7]
Example 2:
Input:Â 23004
Output:Â [0, 4]
Now Your Turn!
Pick the correct output for the given inputInput:Â 5
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 0 ≤ N ≤ 1018