title: Find If Two Strings are Permutations While Prioritizing Time/Long Strings/Short Strings
body: <p>So I am trying to find the best implementation methods to find if two strings are permutations of each other for three cases: 1. for very long input strings, 2. for very long input strings and prioritizing speed, and 3. very short input strings and prioritizing space.</p>
  
  <p>My implementation for the first case is using XOR:</p>
  
  <pre><code>if (string1.length() != string2.length())
      {
          return false;
      }
      int find = 0;
      for(int i = 0; i &lt; string1.length();i++ ){
          find ^= string1.charAt(i) ^ string2.charAt(i);
      }
  
  
      return find == 0;
  </code></pre>
  
  <p>My implementation for the second case is using a hash map or hash set which I haven't implemented yet.</p>
  
  <p>My implementation for the last one is sorting the strings and using java .equals to compare if the strings are equal.</p>
  
  <pre><code>if (string1.length() != string2.length()) {
          return false;
      }
      char[] a = string1.toCharArray();
      char[] b = string2.toCharArray();
  
      Arrays.sort(a);
      Arrays.sort(b);
  
      return Arrays.equals(a, b);
  </code></pre>
  
  <p>** Test input: 2 empty Strings; "ab" "ba"; "abc" "acd"; "<em>rats</em>" "star**"; "\u263A BYE NOW!!" "!BYE NOW! \u263A"</p>
  
  <p>Would these three implementations be best for these cases?    </p>