Back to problems

Find incorrect digit positions in a sum

Algorithm · Upstart · Medium

You are handed three non-negative integers, num1, num2, and statedSum. The true total is $$correct = num1 + num2$$, and statedSum is a claimed total that may or may not agree with it. Your job is to report every digit position at which the claim disagrees with the truth. Positions are counted from the right: position 0 is the units digit, position 1 the tens digit, position 2 the hundreds digit, and so on. Return the list of disagreeing positions, sorted from smallest to…

Checking your access…