Implement a function to check if a given string is an anagram of another string.
Implement a function to check if a given string is an anagram of another string.
262
14-Jun-2023
Aryan Kumar
15-Jun-2023Sure, here is a C# function to check if a given string is an anagram of another string:
C#
This function will first check if the lengths of the two strings are not equal. If they are not equal, the function will return false. If the lengths of the two strings are equal, the function will then create a character array to store the characters of each string. The function will then sort the characters of each string. The function will then compare the sorted characters of the two strings. If the sorted characters of the two strings are equal, the function will return true. Otherwise, the function will return false.