Intuitive Solution


int find(string A, int a, string B, int b, string C, int c)
if(c == C.size())
return 1;
if(C[c] == A[a] && C[c]==B[b])
return (find(A, a+1, B, b, C, c+1) || find(A, a, B, b+1, C, c+1));
else if(C[c] == B[b])
return find(A, a, B, b+1, C, c+1);
else if(C[c] == A[a])
return find(A, a+1, B, b, C, c+1);
return 0;
int Solution::isInterleave(string A, string B, string C)
return find(A,0,B,0,C,0);


for this input why output is 1??
A : “ADEG”


Actually i think you have to put a length constraint if((a.length()+b.length())!=c.length())return 0;
All will work fine then,nice code