Remove Anagram 🍋
A collection of distinct item identifiers must be retrieved from a repository of merchandise listed on Amazon’s platform. In the dataset, duplicate variations of the item IDs exist where the sequence of letters differs (e.g., "code" and "ecode" refer to the same product). To generate the unique set, all anagram duplicates should be eliminated. Two words are considered anagrams if they contain the same characters in the same frequencies, just arranged differently. For instance, "aaagmnrs" is an anagram of "anagrams". Given an array of strings, filter out every entry that is an anagram of a preceding entry, then provide the resultant list in alphabetically sorted order.
Design a method that returns the refined list of strings after discarding anagram duplicates in sorted sequence.
Complete the function removeAnagram in the editor below.
removeAnagram has the following parameter:
inputStrings, a list of strings representing product IDs.
Returns
String Array
Note: Each string inputString[i] is made up of characters in the range ASCII[a-z].
1Example 1
Constraints
Limits and guarantees your solution can rely on.