Where does my Solution goes wrong, (CE & TLE) to Max Query-1

https://rextester.com/CEJR55770

@acharyadhwanan29 use passing by reference, passing by value creates an additional task to copying the parameters and assigning them location.
Your rest of the logic seems to be correct. Just one advice use STL whenever possible no need to implement functions yourself always.


Here have look at this code.
If this resolves your doubt mark it as resolved.