2273. Find Resultant Array After Removing Anagrams

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2273

class Solution:
    def removeAnagrams(self, words: List[str]) -> List[str]:
        return [
            w
            for i, w in enumerate(words)
            if i == 0 or sorted(w) != sorted(words[i - 1])
        ]