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.
Examples
Example 1
Input: n = 31
Output: 3
Explanation:
Example 2
Input: n = 22
Output: 4
Explanation:
Example 3
Input: n = 124
Output: 8
Explanation:
Constraints
10 <= n <= 109
3536. Maximum Product of Two Digits
Easy
10 Points
Math
Sorting
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.
Examples
Example 1
Input: n = 31
Output: 3
Explanation:
Example 2
Input: n = 22
Output: 4
Explanation:
Example 3
Input: n = 124
Output: 8
Explanation:
Constraints
10 <= n <= 109
Maximum Product of Two Digits - Practice Coding | SlaveCode