Can be easily solved using Longest Common Subsequence concept


#1

it should just fulfill the following condition

string A, B, C; // A + B -> C
sizeA = A.size();
sizeB = B.size();

if (sizeA == LCS(A, C) && sizeB == LCS(B, C)) return 1;
else return 0;


#2

What about this test case
Input: YXXYXX YYYXX YXXYYXXXXYX
according to your solution answer is true while correct answer is false but interview bit is accepting your solution


#3

Did the same approach. Not accepted


#4

How about
Step 1 : sizeA == LCS(A,C)
Step 2 : remove the A subsequence from C
Step 3 : sizeB == LCS(B,C)

This should work, right ?


#5

I guess test cases of IB are weak. That’s why it got accepted with this approach. I got WA with this on leetcode.