in this question just remove the case of addition of A,and only consider the cases of addition of B and C.Then the space complexity will be 2^N then whynot our complexity is >2^n ,its only n^2...Adding the condition of only 4A will only stop the 3rd call of the function but the B and C calls will be there
Read more… (59 words)