public static boolean isInterleave(String s1, String s2, String s3) {
        int len1 = s1.length();
        int len2 = s2.length();
        int len3 = s3.length();
        if ((len1+len2) != len3)
        	return false;
        boolean [][] dp = new boolean[len1+1][len2+1];
        for (boolean[] row : dp)
        {
        	Arrays.fill(row, false);
        }
        //empty string interleave of two other strings
        dp[0][0] = true;
        
        //dp[i][j] is true only if s3[i+j-1] is interleaved string of s1[i] and s2[j]
        for (int i=0;i<=len1;i++)
        {
        	for (int j=0;j<=len2;j++)
        	{
        		if (i>0)
        			dp[i][j]=(dp[i-1][j] && s1.charAt(i-1) == s3.charAt(i+j-1));
        		if (j>0)	
        			//the OR operation: accomplished by s1, or accomplished by s2
        			dp[i][j] = dp[i][j] || (dp[i][j-1] && s2.charAt(j-1) == s3.charAt(i+j-1));
        	}
        }
        return dp[len1][len2];
    }