30:00
You are given a positive integer n.
n
Return the maximum product of any two digits of n.
Note: the same digit value may be used twice if it appears more than once in n.
10≤n≤10910 \leq n \leq 10^910≤n≤109
Run code to see results.
Two empty seats: a holds the largest digit, b the second largest. Both start at 0, and we read the digits of 31 from the right.
n = 31, digits read from the right
b
a
a x b = 0 x 0 = 0
Given a positive integer n, return the largest product of two digits taken from two different positions of n.