79593819

Date: 2025-04-26 10:28:25
Score: 0.5
Natty:
Report link

Don't increase ans unconditionally for every word. You already have Counters, so take full advantage of them:

 ans = 0
 chars_freq = Counter(chars)
 for word in targets:
     word_freq = Counter(word)
     if word_freq <= chars_freq:
         ans += 1
 return ans

Attempt This Online!

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Robert