I am not able to understand why I am getting wrong answer in this question. My logic is to check all numbers with x as it’s prefix.

for instance let x = 1 and y = 3. Then I will consider all numbers having trailing zeros and x as a prefix.

x = 10 and y = 3 . to make x divisible by 3 , i have to add 2(y - x % y) to the given x. So my answer would be 12.

But in some cases, I would not be able to add remainder , so I will just check with adding a trailing zero at the end of x. I think my logic is correct. Any suggestion will be acceptable.

Solution Link : Solution Link

Thank in advance