TLE showing. Kindly tell the improvement in code
Instead of calculating the answer for each test case. Create a precomputed prefix array and then return in 0(1) time per query.
I don’t understand…
See you need to precompute before taking query input. And then just return Input[r]- Input[l-1]