当前位置:网站首页>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;
}
};
边栏推荐
- 一条 update 语句的生命经历
- [JS component] date display.
- Where is NPDP product manager certification sacred?
- Longest common subsequence (LCS) (dynamic programming, recursive)
- pytest测试框架——数据驱动
- App clear data source code tracking
- Timer create timer
- Timer创建定时器
- LinkedBlockingQueue源码分析-初始化
- 利用OPNET进行网络任意源组播(ASM)仿真的设计、配置及注意点
猜你喜欢
随机推荐
阿里云的神龙架构是怎么工作的 | 科普图解
2039: [Bluebridge cup 2022 preliminaries] Li Bai's enhanced version (dynamic planning)
“多模态”概念
[JS component] custom select
[optimal web page width and its implementation] [recommended collection "
Leakage relay jelr-250fg
batch size设置技巧
Educational Codeforces Round 22 B. The Golden Age
pytest测试框架——数据驱动
K6el-100 leakage relay
A cool "ghost" console tool
Is it necessary to renew the PMP certificate?
ScheduledExecutorService定时器
漏电继电器LLJ-100FS
做自媒体,有哪些免费下载视频剪辑素材的网站?
Design, configuration and points for attention of network unicast (one server, multiple clients) simulation using OPNET
Safe landing practice of software supply chain under salesforce containerized ISV scenario
Pytest testing framework -- data driven
The founder has a debt of 1billion. Let's start the class. Is it about to "end the class"?
Dbsync adds support for mongodb and ES









