





















大家端午节玩的开心吗~ 😆 思路 统计字母数量,然后计算最小可拼凑字母数即可。 代码 class Solution { public int maxNumberOfBalloons(String text) { int[] cnt = new int[26]; for (int i = 0; i < text.length(); i++) { cnt[text.charAt(i) - 'a']++; } return Math.min(Math.min(Math.min(Math.min(cnt[0], cnt[1]), cnt[11] / 2), cnt[13]), cnt[14] / 2); } }
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。