Largest Digit
Given a non-negative integer n, return the largest digit in its decimal representation. For n = 0, the largest digit is 0.
Given a non-negative integer `n`, return the largest digit in its decimal representation. For `n = 0`, the largest digit is `0`.
- `0 <= n <= 10^9` - The input has no leading zeroes except for the value `0` itself.
Example 1: input n = 482731; output 8. Eight is the largest decimal digit in the number.
Example 2: input n = 4052; output 5. Among 4, 0, 5, and 2, the largest digit is 5.
Example 3: input n = 0; output 0. The only digit is zero.
Category: Math. Topic: math. Difficulty: Easy. Patterns: math.