For those getting TLE:


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


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


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.


it works thanks a lot