Updated: 0 sec ago
Dec 22, 2020 · Two strings are anagrams if they contain a similar group of characters in a varied sequence. Declare a boolean variable that tells at the end of the two strings are anagrams or not. First, check if the length of both strings is the same, if not, they cannot be anagrams. Convert both the strings to character arrays and then sort them.