Ad
  • Custom User Avatar

    In your code, at each iteration, if a character is found in a str1, a new string is created. It turns out that in the worst case you will get str1.length rows in memory

  • Default User Avatar

    I compared some of the solutions here with the Stopwatch and it's only executing about 15% slower than the fastest one. Saying that this is "very inefficient" or "long non-efficient" is definitively an overstatement.

  • Custom User Avatar

    Wrong, since input charset is fixed and hence a constant. It's still O(n^2) though ;-)