For those getting TLE:


#1

If you are getting TLE in your implementation, pass the vectors by reference. It’ll work.


#2

Thank you jeet.
Wouldn’t have figured that out.


#3

And why is that happening exactly? Is it due to the fact that if we do no pass it by refrence, everytime a copy of the vectors has to be created in each recursion call, increasing the number of operations, which is not the case in passing by ref.


#4

it works thanks a lot