916-Word-Subsets

Sat 17 May 2025

https://leetcode.com/problems/word-subsets

import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
  def wordSubsets(self, A: List[str], B: List[str]) -> List[str]:
    count = Counter()

    for b in B:
      count = count | Counter(b)

    return [a for a in A if Counter(a) & count == count]
new Solution().wordSubsets()

Score: 5

Category: leetcode