Single-Digit Addition Equation Repairs
Updated
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
More ZipRecruiter Online Assessment questions
- Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
- Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
- Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
- Minimum Changes to Draw a YOA · Seen Oct 2024
- Apply Binary State OperationsOA · Seen Sep 2024
- Simulate Orchard Rot SpreadOA · Seen Sep 2024
- Compare Odd- and Even-Index SumsOA · Seen Sep 2024
- Coordinate Removals with Column GravityOA · Seen Sep 2024
- Lexicographically Smallest End ReversalOA · Seen Sep 2024
- Recursively Expanded Shell Command CountsOA · Seen Sep 2024
Similar questions at other companies
- Basic Calculator IITypeSafe AI · OA
- Perfect Squares Matching a PatternNielsen · OA
- Simplify a Quadratic ExpressionOpenAI · OAOpenAI interview questions
- Next Number with Disjoint DigitsElevenLabs · OAElevenLabs interview questions
- Vowel Substring GameAkuna Capital · OAAkuna Capital interview questions
- Minimum Anagram PeriodVisa · OAVisa interview questions
- Return Exact Cash Register ChangeBank of America · OABank of America interview questions
- Maximum Equal Parts for PrefixesAmazon · OA
- Minimum Anagram PeriodWells Fargo · OAWells Fargo interview questions
- Minimum Digit Swaps for the Smallest DifferenceLSEG · OALSEG interview questions