当前位置:网站首页>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
边栏推荐
- [Oracle] simple date and time formatting and sorting problem
- [QT] custom control loading
- Dj-zbs2 leakage relay
- Mybaits之多表查询(联合查询、嵌套查询)
- Unity让摄像机一直跟随在玩家后上方
- 做自媒体,有哪些免费下载视频剪辑素材的网站?
- app clear data源码追踪
- Talk about mvcc multi version concurrency controller?
- [JS component] custom select
- Simulate thread communication
猜你喜欢
随机推荐
SQL injection cookie injection
Timer创建定时器
How Alibaba cloud's DPCA architecture works | popular science diagram
Timer create timer
High voltage leakage relay bld-20
Leetcode (46) - Full Permutation
Y58. Chapter III kubernetes from entry to proficiency - continuous integration and deployment (Sany)
Auto. JS get all app names of mobile phones
JHOK-ZBL1漏电继电器
[Oracle] simple date and time formatting and sorting problem
DFS,BFS以及图的遍历搜索
一条 update 语句的生命经历
Creation and use of thread pool
Intelligent annotation scheme of entity recognition based on hugging Face Pre training model: generate doccano request JSON format
Egr-20uscm ground fault relay
做自媒体,有哪些免费下载视频剪辑素材的网站?
漏电继电器LLJ-100FS
Use Zhiyun reader to translate statistical genetics books
JVM (19) -- bytecode and class loading (4) -- talk about class loader again
论文阅读【Sensor-Augmented Egocentric-Video Captioning with Dynamic Modal Attention】