Tap here to switch tabs
Problem
Submissions

Problem: Find Resultant Array After Removing Anagrams

med
30 min
Try to solve the Find Resultant Array After Removing Anagrams problem.

Statement

You are given a 00 indexed array of strings words.

In a single operation, you can select any index i such that 0<i<0 < i < words.length where words[i] and words[i - 1] are anagrams of each other, and delete words[i] from words.

Repeat this process until no such index i can be chosen. Return the resulting array words.

Note: An anagram is a word created by rearranging the letters of a different word, using all original letters exactly once.

Constraints:

  • 1≤1 \leq words.length ≤100\leq 100

  • 1≤1 \leq words[i].length ≤10\leq 10

  • words[i] consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Resultant Array After Removing Anagrams

med
30 min
Try to solve the Find Resultant Array After Removing Anagrams problem.

Statement

You are given a 00 indexed array of strings words.

In a single operation, you can select any index i such that 0<i<0 < i < words.length where words[i] and words[i - 1] are anagrams of each other, and delete words[i] from words.

Repeat this process until no such index i can be chosen. Return the resulting array words.

Note: An anagram is a word created by rearranging the letters of a different word, using all original letters exactly once.

Constraints:

  • 1≤1 \leq words.length ≤100\leq 100

  • 1≤1 \leq words[i].length ≤10\leq 10

  • words[i] consists of lowercase English letters.