I need a little help regarding this small problem.
Given two number a and b and two reminders rem1 and rem2. You need to find all number x which is satisfying following condition.
x%a = rem1 and x%b = rem2
e.g. a=11, b=14, rem1=0, rem2=2 then ans is x=44
I know one simple solution is via for loop but that is not good approach.
Actually I need a formula or some pattern which will give me answer efficiently.