当前位置:网站首页>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
边栏推荐
- Longest palindrome substring (dynamic programming)
- app clear data源码追踪
- ScheduledExecutorService定时器
- Disk monitoring related commands
- 人体传感器好不好用?怎么用?Aqara绿米、小米之间到底买哪个
- What changes will PMP certification bring?
- ssm框架的简单案例
- 高级程序员必知必会,一文详解MySQL主从同步原理,推荐收藏
- NPDP产品经理认证,到底是何方神圣?
- Record a pressure measurement experience summary
猜你喜欢

Is PMP really useful?

Harmonyos fourth training

Auto. JS get all app names of mobile phones

在米家、欧瑞博、苹果HomeKit趋势下,智汀如何从中脱颖而出?

论文阅读【MM21 Pre-training for Video Understanding Challenge:Video Captioning with Pretraining Techniqu】

JHOK-ZBG2漏电继电器
![[JS component] date display.](/img/26/9bfc752c8c9a933a8e33b59e0488a2.jpg)
[JS component] date display.

漏电继电器JOLX-GS62零序孔径Φ100

Senior programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization, and recommends collecting

【js组件】date日期显示。
随机推荐
[JS component] date display.
10 distributed databases that take you to the galaxy
SQL injection cookie injection
SQL injection - secondary injection and multi statement injection
删除文件时提示‘源文件名长度大于系统支持的长度’无法删除解决办法
Autowired注解用于List时的现象解析
最长不下降子序列(LIS)(动态规划)
Timer create timer
漏电继电器JELR-250FG
“多模态”概念
设f(x)=∑x^n/n^2,证明f(x)+f(1-x)+lnxln(1-x)=∑1/n^2
Flink SQL 实现读写redis,并动态生成Hset key
How can project managers counter attack with NPDP certificates? Look here
DFS,BFS以及图的遍历搜索
做自媒体,有哪些免费下载视频剪辑素材的网站?
If you want to choose some departments to give priority to OKR, how should you choose pilot departments?
背包问题(01背包,完全背包,动态规划)
数字化如何影响工作流程自动化
Leetcode (46) - Full Permutation
Wonderful express | Tencent cloud database June issue