@@ -0,0 +1,1544 @@
+package leetcode.interleaving_string;%0A%0Aimport java.util.LinkedList;%0Aimport java.util.Queue;%0A%0Apublic class Solution %7B%0A%09public static class PossibleState%7B%0A%09%09int len1;%0A%09%09int len2;%0A%09%09public PossibleState(int len1, int len2)%7B%0A%09%09%09this.len1 = len1;%0A%09%09%09this.len2 = len2;%0A%09%09%7D%0A%09%7D%0A    public boolean isInterleave(String s1, String s2, String s3) %7B%0A    %09if(s1.length() + s2.length() != s3.length()) return false;%0A    %09boolean%5B%5D%5B%5D possible = new boolean%5Bs1.length() + 1%5D%5Bs2.length() + 1%5D;%0A    %09Queue%3CPossibleState%3E queue = new LinkedList%3CPossibleState%3E();%0A    %09possible%5B0%5D%5B0%5D = true;%0A    %09queue.offer(new PossibleState(0, 0));%0A    %09while(!queue.isEmpty())%7B%0A    %09%09PossibleState state = queue.remove();%0A    %09%09int totalLen = state.len1 + state.len2;%0A    %09%09if(totalLen == s3.length()) return true;%0A    %09%09if(state.len1 %3C s1.length())%7B%0A    %09%09%09if(!possible%5Bstate.len1 + 1%5D%5Bstate.len2%5D)%7B%0A    %09%09%09%09if(s1.charAt(state.len1) == s3.charAt(totalLen))%7B%0A    %09%09%09%09%09possible%5Bstate.len1 + 1%5D%5Bstate.len2%5D = true;%0A    %09%09%09%09%09queue.offer(new PossibleState(state.len1 + 1, state.len2));%0A    %09%09%09%09%7D%0A    %09%09%09%7D%0A    %09%09%7D%0A    %09%09if(state.len2 %3C s2.length())%7B%0A    %09%09%09if(!possible%5Bstate.len1%5D%5Bstate.len2 + 1%5D)%7B%0A    %09%09%09%09if(s2.charAt(state.len2) == s3.charAt(totalLen))%7B%0A    %09%09%09%09%09possible%5Bstate.len1%5D%5Bstate.len2 + 1%5D = true;%0A    %09%09%09%09%09queue.offer(new PossibleState(state.len1, state.len2 + 1));%0A    %09%09%09%09%7D%0A    %09%09%09%7D%0A    %09%09%7D%0A    %09%7D%0A    %09return false;%0A    %7D%0A    %0A    public static void main(String%5B%5D args)%7B%0A    %09System.err.println(new Solution().isInterleave(%22abccc%22, %22deffg%22, %22adeffgbccc%22));%0A    %7D%0A%7D%0A

Add java solution for 97. Interleaving String