title: Remove characters from the second string which are present in the first string
body: <p>I have written a program to remove the characters from the second string which are present in the first string. The complexity comes out to be BigO(n^2). Can the complexity be further reduced?</p>
  
  <pre><code>public class Tmp {
  
      public static void main(String[] args) {
          String s = "halloween";
          String s1 = "halcyon";
          char[] ss = s.toCharArray();
          char[] ss1 = s1.toCharArray();
  
          for(int i=0;i&lt;ss.length;i++){
            for(int j=0;j&lt;ss1.length;j++){
                  if(ss1[j] == ss[i]){
                      ss1[j] = 'x'; //Replace the common char with x
                  }
              }
           }
          System.out.println(Arrays.toString(ss1));
      }
  }
  </code></pre>
  
  <p>OUTPUT</p>
  
  <pre><code> [x, x, x, c, y, x, x]
  </code></pre>