Is this solution correct and optimal? Seems to be only O(Len(s3)). Is DP solution better than this?

public int isInterleave(string s1, string s2, string s3)
{
int n1 = s1.Length;
int n2 = s2.Length;
int n3 = s3.Length;
if(n3 != n1 + n2) return 0;

    bool s1Found = Contains(s3, s1);
    bool s2Found = Contains(s3, s2);
    if(s1Found && s2Found) return 1;
    
    return 0;
}

private bool Contains(string str, string sub)
{
    int subPos = 0;
    for(int j=0; j<str.Length && subPos<sub.Length; j++)
    {
        if(sub[subPos] == str[j])
        {
            subPos++;
        }
    }
    L("Found: {0}, sub:{1}", subPos==sub.Length, sub);
    return subPos==sub.Length;
}
Click here to start solving coding interview questions