当前位置:网站首页>Force buckle 1189 Maximum number of "balloons"
Force buckle 1189 Maximum number of "balloons"
2022-07-06 05:06:00 【Three watch ghost】
Title source :https://leetcode-cn.com/problems/maximum-number-of-balloons/
General meaning :
Give a string , Find out how many words the letters can form balloon
Ideas
- Traversal string , Statistics balloon Number of corresponding letters
- Returns the least number of letters in the statistics
public int maxNumberOfBalloons(String text) {
int[] count = new int[5];
int n = text.length();
for (int i = 0; i < n; i++) {
char c = text.charAt(i);
switch (c) {
case 'b':
count[0]++;
break;
case 'a':
count[1]++;
break;
case 'l':
count[2]++;
break;
case 'o':
count[3]++;
break;
case 'n':
count[4]++;
break;
default:
break;
}
}
count[2] /= 2;
count[3] /= 2;
return Arrays.stream(count).min().getAsInt();
}
边栏推荐
- 关于es8316的音频爆破音的解决
- Why does MySQL need two-phase commit
- A little knowledge of CPU, disk and memory
- Postman断言
- Orm-f & Q object
- GAMES202-WebGL中shader的编译和连接(了解向)
- Three methods of Oracle two table Association update
- Postman关联
- Redis 排查大 key 的4种方法,优化必备
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
猜你喜欢

Talking about the type and function of lens filter

JS quick start (II)

你需要知道的 TCP 三次握手

浅谈镜头滤镜的类型及作用

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

Principle and performance analysis of lepton lossless compression

acwing周赛58

Postman pre script - global variables and environment variables

RTP gb28181 document testing tool

Compilation et connexion de shader dans games202 - webgl (comprendre la direction)
随机推荐
最高法院,离婚案件判决标准
Class inheritance in yyds dry inventory C
Raspberry pie 3.5-inch white screen display connection
Introduction of several RS485 isolated communication schemes
麦斯克电子IPO被终止:曾拟募资8亿 河南资产是股东
ISP learning (2)
Pagoda configuration mongodb
idea一键导包
[buuctf.reverse] 159_ [watevrCTF 2019]Watshell
你需要知道的 TCP 三次握手
The kernel determines whether peripherals are attached to the I2C address
IPv6 comprehensive experiment
ORM aggregate query and native database operation
[noip2008 improvement group] stupid monkey
Fiddler installed the certificate, or prompted that the certificate is invalid
Three methods of Oracle two table Association update
Summary of redis AOF and RDB knowledge points
Nacos - TC Construction of High available seata (02)
MySQL if and ifnull use
CUDA11.1在线安装