Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3
two strings are anagrams if and only if they contain the same set of characters a smart way to determine it is to sort the letters in both strings and compare the arrays - that's what the code does peek and keep are anagrams, beacuse they both are in sorted order "eekp" since the case of letters does not matter it's converted to lower case
10th Jan 2018, 5:38 PM
michal