Maximum Product of Two Digits
You are given a positive integer n.
Return the maximum product of any two digits in n.
Note: You may use the same digit twice if it appears more than once in n.
Example 1
Input
n = 31Output
3The digits are [3, 1], and the only possible product is 3 * 1 = 3.
Example 2
Input
n = 22Output
4The digits are [2, 2], so using both occurrences gives the maximum product 2 * 2 = 4.
Constraints
- 10 <= n <= 10^9