diff --git a/Algorithms/Strings/Permutations.cs b/Algorithms/Strings/Permutations.cs index fe15d8a9..dd066d09 100644 --- a/Algorithms/Strings/Permutations.cs +++ b/Algorithms/Strings/Permutations.cs @@ -61,9 +61,9 @@ public static HashSet ComputeDistinct(string source) } /// - /// Determines if the Other string is an anargram of the Source string. + /// Determines if the Other string is an anagram of the Source string. /// - public static bool IsAnargram(string source, string other) + public static bool IsAnagram(string source, string other) { if (string.IsNullOrEmpty(source) || string.IsNullOrEmpty(other)) return false; @@ -83,7 +83,7 @@ public static bool IsAnargram(string source, string other) } for (int i = 0; i < len; i++) { - // Inputs are not Anargram if characers from *other are not present in *source. + // Inputs are not Anagram if characers from *other are not present in *source. if (!hashSetSourceChars.Contains(other[i])) return false; if (!hashSetOtherChars.Contains(source[i])) return false; } diff --git a/UnitTest/AlgorithmsTests/StringPermutationTests.cs b/UnitTest/AlgorithmsTests/StringPermutationTests.cs index 0e8b8b82..88828e5c 100644 --- a/UnitTest/AlgorithmsTests/StringPermutationTests.cs +++ b/UnitTest/AlgorithmsTests/StringPermutationTests.cs @@ -16,27 +16,27 @@ public static void DoTest() var one = "abcdefg"; var two = "dabcgfe"; - Assert.True(Permutations.IsAnargram(one, two) == true); + Assert.True(Permutations.IsAnagram(one, two) == true); one = "123456"; two = "789123"; - Assert.True(Permutations.IsAnargram(one, two) == false); + Assert.True(Permutations.IsAnagram(one, two) == false); one = "abc"; two = "bbb"; - Assert.True(Permutations.IsAnargram(one, two) == false); + Assert.True(Permutations.IsAnagram(one, two) == false); one = "acdf"; two = "bcde"; - Assert.True(Permutations.IsAnargram(one, two) == false); + Assert.True(Permutations.IsAnagram(one, two) == false); one = "I am legion"; // L is small two = "Legion I am"; // L is capital - Assert.True(Permutations.IsAnargram(one, two) == false); + Assert.True(Permutations.IsAnagram(one, two) == false); one = "I am legion"; // L is small two = "legion I am"; // L is small - Assert.True(Permutations.IsAnargram(one, two) == true); + Assert.True(Permutations.IsAnagram(one, two) == true); } } }