Unable to find logic

  • I am unable to think of the logic for that problem.

  • 1st way will be that with for loop we will increase the number until it is greater or equal to another number but for the higher number, it will exceed the time limit so what will be another logic & why??

You can have a look at ALTERADD - Editorial