Sobes.tech
Junior — Senior

Grouping list words by anagrams

livecode

Task condition

Given a set of strings. It is necessary to group them where each group consists of anagrams — words containing the same set of letters but arranged in a different order. When forming groups, case sensitivity and spaces are not considered.

public static void main(String[] args) {
    List<String> anagrams = List.of("Race", "NIght", " Angel", "Care",  "angel",  "ThiNG",  "angel",  "angel") ;
    System.out.println(removeAnagrams(anagrams));
}