【文件属性】:
文件名称:最大公共字符串leetcode-maximum-number-of-balloons:气球的最大数量
文件大小:978B
文件格式:ZIP
更新时间:2021-07-01 01:23:06
系统开源
最大公共字符串leetcode
气球的最大数量
给定一个字符串文本,您希望使用文本字符来形成尽可能多的单词“balloon”的实例。
您最多可以在文本中使用每个字符一次。
返回可以形成的最大实例数。
Example
1:
Input:
text
=
"nlaebolko"
Output:
1
Example
2:
Input:
text
=
"loonbalxballpoon"
Output:
2
Example
3:
Input:
text
=
"leetcode"
Output:
0
约束:
1
<=
文本长度
<=
10^4
文本仅由小写英文字母组成。
实施1
class
Solution
{
public
int
maxNumberOfBalloons
(
String
text
)
{
String
target
=
"
balloon
"
;
if
(text
==
null
||
text
.
length()
<
target
.
length())
return
0
;
String
string
=
"
"
;
int
i
=
0
,
match
=
0
;
int
【文件预览】:
maximum-number-of-balloons-main
----README.md(1KB)