Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Mohammed Dh Abbas
Simpler way to go about it

Mohammed Dh Abbas

May 31, 2024

from collections import Counter class Solution: def maxNumberOfBalloons(self, text: str) -> int: min_count = float('inf') balloon_counter = Counter('balloon') text_counter = Counter(text) for char, freq in balloon_counter.items(): if char not in text_counter: return 0 else: min_count = min(min_count, text_counter[char] // freq) return min_count

1

0

Comments
Comments

On this page