Regular Expression II Time : O(nm) Space : O(nm) 123456789101112int Solution::isInterleave(string A, string B, string C) { if(A.length() + B.length() != C.length()) return 0; int dp[155][155] = {}; dp[0][0] = 1; for(int i = 0; i <= A.length(); i++) { for(int j = 0; j <= B.length(); j++) { if(i != A.length() and C[i+j] == A[i]) dp[i+1][j] |= dp[i][j]; if(j != B.length() and C[i+j] == B[j]) dp[i][j+1] |= dp[i][j]; } } return dp[A.length()][B.length()];}