Single-Digit Addition Equation Repairs
Problem statement
a, b, and c are positive decimal strings containing no zero digits. Change exactly one digit in exactly one input to a different digit from 1 through 9.
Count substitutions after which a + b = c.
Function
countEquationRepairs(a: String, b: String, c: String) → intExamples
Example 1
a = "7"b = "1"c = "7"return = 2Changing b to 0 is forbidden; the two valid nonzero repairs satisfy the equation.
Example 2
a = "1"b = "1"c = "2"return = 0The equation is already true, but exactly one different digit must be changed.
Constraints
1 <= a.length,b.length,c.length <= 15