Simple enough doubt


this code isn’t able to pass all the test cases…what approach should i use now?

Hello @sghosh2018,

  1. The value of n is 10^16 which is greater than the range of array.
  2. Try to reduce the time complexity of the program as you are computing res(floor(n/2)) twice.
  3. at last just iterate the loop from l to r.

Hope, this would help.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.