当前位置:网站首页>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
边栏推荐
- Use, configuration and points for attention of network layer protocol (taking QoS as an example) when using OPNET for network simulation
- App clear data source code tracking
- 漏电继电器JOLX-GS62零序孔径Φ100
- 利用OPNET进行网络仿真时网络层协议(以QoS为例)的使用、配置及注意点
- 痛心啊 收到教训了
- Is PMP really useful?
- 《5》 Table
- Autowired注解用于List时的现象解析
- How does redis implement multiple zones?
- 在米家、欧瑞博、苹果HomeKit趋势下,智汀如何从中脱颖而出?
猜你喜欢
JVM (19) -- bytecode and class loading (4) -- talk about class loader again
LabVIEW is opening a new reference, indicating that the memory is full
漏电继电器JOLX-GS62零序孔径Φ100
高级程序员必知必会,一文详解MySQL主从同步原理,推荐收藏
张平安:加快云上数字创新,共建产业智慧生态
DJ-ZBS2漏电继电器
Leetcode (417) -- Pacific Atlantic current problem
pytest测试框架——数据驱动
【js组件】自定义select
基于 hugging face 预训练模型的实体识别智能标注方案:生成doccano要求json格式
随机推荐
Timer创建定时器
高压漏电继电器BLD-20
漏电继电器JOLX-GS62零序孔径Φ100
论文阅读【MM21 Pre-training for Video Understanding Challenge:Video Captioning with Pretraining Techniqu】
K6EL-100漏电继电器
[optimal web page width and its implementation] [recommended collection "
A cool "ghost" console tool
English语法_名词 - 所有格
Autowired注解用于List时的现象解析
ThinkPHP Association preload with
设f(x)=∑x^n/n^2,证明f(x)+f(1-x)+lnxln(1-x)=∑1/n^2
Is PMP really useful?
最长不下降子序列(LIS)(动态规划)
Longest common subsequence (LCS) (dynamic programming, recursive)
DOM-节点对象+时间节点 综合案例
Educational Codeforces Round 22 B. The Golden Age
[QT] custom control loading
Tencent cloud database public cloud market ranks top 2!
Summary of the mean value theorem of higher numbers
DJ-ZBS2漏电继电器