I did this in O(N) but its still giving TLE. Please check and revert back
hello @gaganpreetsachdev1

a) u need to handle this case
b) no need to store queries in vector (this is bit time consuming), just read query one by one and answer accordingly
hello @gaganpreetsachdev1

a) u need to handle this case
b) no need to store queries in vector (this is bit time consuming), just read query one by one and answer accordingly