@@ -0,0 +1,1517 @@
+package com.sunny.grokkingalgorithms.fasttrack.dynamicprogrammingandrecursion;%0A%0A/**%0A * Created by sundas on 6/13/2018.%0A */%0Apublic class StringInterleaving %7B%0A%0A  /*%0A  Give two strings a and b and a third string c. Check if%0A  c is an interleaving of a and b%0A  for example: c = xabyczd is an interleaving of a = xyz and b = abcd%0A   */%0A%0A  /**%0A   *%0A   * @param a%0A   * @param b%0A   * @param c%0A   * @return%0A   */%0A  public static boolean isInterLeaving(String a,String b,String c)%7B%0A    boolean interLeaved = false;%0A    if(a == null %7C%7C b == null %7C%7C c == null)%7B%0A      return interLeaved;%0A    %7D%0A    if(c.length() != (a.length() + b.length()))%7B%0A      return interLeaved;%0A    %7D%0A    /*%0A    Check if a's characters exist and are in order%0A     */%0A    StringBuilder cBuilder = new StringBuilder(c);%0A    int aIndex = 0;%0A    while(aIndex %3C a.length())%7B%0A      char current = a.charAt(aIndex);%0A      int index = -1;%0A      if((index = cBuilder.indexOf(%22%22+current)) %3E= 0)%7B%0A        cBuilder.deleteCharAt(index);%0A      %7D%0A      aIndex++;%0A    %7D%0A    if(cBuilder.toString().equals(b))%7B%0A      interLeaved = true;%0A    %7D%0A    return interLeaved;%0A  %7D%0A%0A  /**%0A   *%0A   * @param args%0A   */%0A  public static void main(String%5B%5D args) %7B%0A    String a = %22xyz%22;%0A    String b = %22abcd%22;%0A    String c = %22xabyczd%22;%0A    System.out.println(isInterLeaving(a,b,c));%0A    a = %22sunny%22;%0A    b = %22das%22;%0A    c = %22sdaunnys%22;%0A    System.out.println(isInterLeaving(a,b,c));%0A    a = %22ten%22;%0A    b = %22twenty%22;%0A    c = %22tentwentu%22;%0A    System.out.println(isInterLeaving(a,b,c));%0A  %7D%0A%7D%0A

Find interleaving of strings , naive solution. O(n.squared).