Didn't use DP still got all test cases pass. though the algo is recursive

I have used recursive algorithm to solve the problem. Here is my code.

bool way(string A,string B,string C,int i,int j,int k){
if(i==A.size()&&j==B.size()&&k==C.size()) return true;
if(i<A.size()){
if(A[i]==C[k]){
if(way(A,B,C,i+1,j,k+1))
return true;
}
} if(j<B.size()){
if(B[j]==C[k])
if(way(A,B,C,i,j+1,k+1))
return true;
}
return false;
}
int Solution::isInterleave(string A, string B, string C) {
//if(C.size()!=A.size()+B.size()||C.size()==0) return 0;
int i=0,j=0;
if(way(A,B,C,i,j,0))
return 1;
return 0;
}

I want to know why my code has passed all test cases without TLE though it does not use dynamic programing.

Click here to start solving coding interview questions