-
I'm very intrigued on this and I'd like it if someone with experience could give me some advice on my question, it would be much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Two strings are anagrams if they contain similar characters in a varied sequence. Declare a boolean variable that tells at the end of the two strings are anagrams or not. |
Beta Was this translation helpful? Give feedback.
Two strings are anagrams if they contain similar 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.
Check if the sorted arrays are equal. If they are equal, print anagrams, otherwise not anagrams.