当前位置:网站首页>Leetcode: maximum number of "balloons"
Leetcode: maximum number of "balloons"
2022-07-07 05:31:00 【White speed Dragon King's review】
use counter Make a note of
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
cnt = Counter()
ans = 0x7f7f7f7f
for c in text:
cnt[c] += 1
# Look at each word
ans = min(ans, cnt['b'])
ans = min(ans, cnt['a'])
ans = min(ans, cnt['n'])
ans = min(ans, cnt['l'] // 2)
ans = min(ans, cnt['o'] // 2)
return ans
边栏推荐
猜你喜欢
SQL injection cookie injection
《2》 Label
[JS component] custom select
Autowired注解用于List时的现象解析
【js组件】自定义select
Y58. Chapter III kubernetes from entry to proficiency - continuous integration and deployment (Sany)
Is it necessary to renew the PMP certificate?
Auto. JS get all app names of mobile phones
Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting
[question] Compilation Principle
随机推荐
漏电继电器JOLX-GS62零序孔径Φ100
High voltage leakage relay bld-20
Codeforces Round #416 (Div. 2) D. Vladik and Favorite Game
利用OPNET进行网络任意源组播(ASM)仿真的设计、配置及注意点
《5》 Table
DFS,BFS以及图的遍历搜索
Knapsack problem unrelated to profit (depth first search)
说一说MVCC多版本并发控制器?
QT simple layout box model with spring
什么是依赖注入(DI)
论文阅读【Semantic Tag Augmented XlanV Model for Video Captioning】
How can professional people find background music materials when doing we media video clips?
Leetcode (46) - Full Permutation
数字化创新驱动指南
If you want to choose some departments to give priority to OKR, how should you choose pilot departments?
Wonderful express | Tencent cloud database June issue
DOM-节点对象+时间节点 综合案例
漏电继电器JD1-100
Design, configuration and points for attention of network arbitrary source multicast (ASM) simulation using OPNET
The navigation bar changes colors according to the route