Hey , I just saw the editorial of this question and I did not understand how pre-computation does not give TLE
Like even when we are precomputing we iterate through all the values and still use % 1e9 + 7
Is it that we face that only because of the calculation of 2^n and we avoid that by using
ans = 1;
for(int i =2; i< MX ; i++)
ans[i] = (ans[i - 1] * 2) % MOD;
here MX is range of n and MOD is 1e9 + 7
The modulus operation doesn’t give TLE when working with large values like 1e9 + 7 ?