-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathballoons.py
More file actions
40 lines (35 loc) · 983 Bytes
/
balloons.py
File metadata and controls
40 lines (35 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
numA = numB = numL = numO = numN = 0
for char in text:
if char not in ['a','b','l','n','o']:
continue
if char == 'a':
numA += 1
print("Debug")
continue
if char == 'b':
numB += 1
continue
if char == 'l':
numL += 1
continue
if char == 'n':
numN += 1
continue
if char == 'o':
numO += 1
continue
numL = numL // 2
numO = numO // 2
return min(numA, numB, numL, numO, numN)
def main():
sol = Solution()
text1 = "nlaebolko"
text2 = "loonbalxballpoon"
text3 = "leetcode"
text4 = "balon"
print(1 // 2)
print(sol.maxNumberOfBalloons(text4))
if __name__ == "__main__":
main()