当前位置:网站首页>Leetcode 1189 maximum number of "balloons" [map] the leetcode road of heroding
Leetcode 1189 maximum number of "balloons" [map] the leetcode road of heroding
2022-07-07 05:31:00 【HERODING23】

Their thinking :
Count the number of all letters , And then according to balloon The number of five letters in a word , Count the maximum number of words that can be formed ( Take the minimum value that each letter can form the most words ), The code is as follows :
class Solution {
public:
int maxNumberOfBalloons(string text) {
vector<int> count(26, 0);
for(auto c : text) {
count[c - 'a'] ++;
}
int ans = min(count[1], min(count[0], min(count['l' - 'a'] / 2, min(count['o' - 'a'] / 2, count['n' - 'a']))));
return ans;
}
};
边栏推荐
- 说一说MVCC多版本并发控制器?
- When deleting a file, the prompt "the length of the source file name is greater than the length supported by the system" cannot be deleted. Solution
- How can project managers counter attack with NPDP certificates? Look here
- Batch size setting skills
- pytest测试框架——数据驱动
- SQL injection - secondary injection and multi statement injection
- 2039: [Bluebridge cup 2022 preliminaries] Li Bai's enhanced version (dynamic planning)
- 什么是依赖注入(DI)
- 漏电继电器LLJ-100FS
- Longest common subsequence (LCS) (dynamic programming, recursive)
猜你喜欢
![[question] Compilation Principle](/img/ce/71f8409ba2cebd497bed0210290895.png)
[question] Compilation Principle

Photo selector collectionview

Phenomenon analysis when Autowired annotation is used for list

高压漏电继电器BLD-20

Zero sequence aperture of leakage relay jolx-gs62 Φ one hundred

Mysql database learning (8) -- MySQL content supplement

What changes will PMP certification bring?

Complete code of C language neural network and its meaning

10 distributed databases that take you to the galaxy

Design, configuration and points for attention of network unicast (one server, multiple clients) simulation using OPNET
随机推荐
Simulate thread communication
删除文件时提示‘源文件名长度大于系统支持的长度’无法删除解决办法
做自媒体,有哪些免费下载视频剪辑素材的网站?
论文阅读【Semantic Tag Augmented XlanV Model for Video Captioning】
If you want to choose some departments to give priority to OKR, how should you choose pilot departments?
导航栏根据路由变换颜色
Disk monitoring related commands
The navigation bar changes colors according to the route
Is the human body sensor easy to use? How to use it? Which do you buy between aqara green rice and Xiaomi
When deleting a file, the prompt "the length of the source file name is greater than the length supported by the system" cannot be deleted. Solution
sql优化常用技巧及理解
在米家、欧瑞博、苹果HomeKit趋势下,智汀如何从中脱颖而出?
DOM node object + time node comprehensive case
AIDL 与Service
[论文阅读] A Multi-branch Hybrid Transformer Network for Corneal Endothelial Cell Segmentation
Life experience of an update statement
Batch size setting skills
Is PMP really useful?
纪念下,我从CSDN搬家到博客园啦!
Timer create timer