Recursive solution for the given problem is giving MLE.Why?


#1

is a recursive solution acceptable for this problem ?


#3

recursive solution is acceptable!!
but it seems that you use vector v in defination of your recusive function .replace it by
const vector& v ans your solution will not get MLE.


#4

@gargsakshi, I replaced vector A with const vector &A and now I am getting runtime error.
Any suggestions?