Sum of Odd Digits
Given a non-negative integer n, return the sum of the odd digits in its decimal representation. For n = 0, return 0 because its only digit is even.
Given a non-negative integer `n`, return the sum of the odd digits in its decimal representation. For `n = 0`, return `0` because its only digit is even.
- `0 <= n <= 10^9` - The input has no leading zeroes except for the value `0` itself.
Example 1: input n = 482731; output 11. The odd digits are 7, 3, and 1, whose sum is 11.
Example 2: input n = 24680; output 0. There are no odd digits.
Example 3: input n = 507; output 12. The odd digits 5 and 7 sum to 12.
Category: Math. Topic: math. Difficulty: Easy. Patterns: math.