diff --git a/Algorithms/Strings/Permutations.cs b/Algorithms/Strings/Permutations.cs index fe15d8a9..aac366b3 100644 --- a/Algorithms/Strings/Permutations.cs +++ b/Algorithms/Strings/Permutations.cs @@ -73,19 +73,13 @@ public static bool IsAnargram(string source, string other) return true; int len = source.Length; - // Hash set which will contains all the characters present in input source. - var hashSetSourceChars = new HashSet(); - var hashSetOtherChars = new HashSet(); - for (int i = 0; i < len; i++) + //loops and removes chars from other string so they wouldn't count the same char twice + for(int i = 0; i