Valid Anagram
Problem Determine whether two strings are anagrams of each other (same characters with the same frequencies). Then, given a list of strings, group all anagrams together.
Input / Output
- Input: for part one, two strings
sandt; for part two, an array of strings. - Output: part one, a boolean; part two, a list of groups, each group containing mutually-anagram strings.
Constraints
1 <= |s| <= 10^5- Define whether comparison is case-sensitive and the character set (lowercase a-z vs full Unicode).
Example
"listen", "silent"->true;"rat", "car"->false- group
["eat","tea","tan","ate","nat","bat"]->[["eat","tea","ate"],["tan","nat"],["bat"]]
added …