Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. ```
  2. from collections import Counter
  3.  
  4. class Solution(object):
  5. def maxNumberOfBalloons(self, text):
  6. """
  7. :type text: str
  8. :rtype: int
  9. """
  10. ballon_counter = Counter("balloon")
  11. text_counter = Counter(text)
  12.  
  13. min_count = float("inf")
  14. for letter, count_needed in ballon_counter.items():
  15. min_count = min(min_count, text_counter[letter]/count_needed)
  16. return min_count
  17. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement