Cover them all from Mathematics question

Question link https://hack.codingblocks.com/app/practice/3/715/problem

My code link

I am getting tle for above question. Can you tell me better approach?

hello @div_yanshu07

u r getting tle becuase ur approach time complexity is O(N^2).

This question make use of binary indexed tree , so try to think in that direction

This question involves Fenwick tree?

yeah … … …