Suppose we have two numbers A and B. We need to find a multiple of A such the A % B is maximized One such solution can be to traverse B multiples of A? is there any other soltuion?(In case B is huge)
Suppose A=3 and B=10. then 10 multiples of 3 are 3,6,9.......30.
Max remainder will be 9%10=9.
Suppose A=14 and B=11 then 11 multiples of 14 are 14,28..........140,154.
Then max remainder 98%11=10 .
Is there any more effective way to find this?