Skip to content

Conversation

@ChesterChangLiu
Copy link
Contributor

No description provided.

@javadev
Copy link

javadev commented Mar 11, 2022

The alternative solution

public class Solution {
    public int maxNumberOfBalloons(String text) {
        int[] counts = new int[26];
        for (char c : text.toCharArray()) {
            counts[c - 'a']++;
        }
        return Math.min(
                counts[0],
                Math.min(
                        counts[1], Math.min(counts[11] / 2, Math.min(counts[14] / 2, counts[13]))));
    }
}

@qiyuangong
Copy link
Owner

LGTM
Thank you for your contribution @ChesterChangLiu @javadev !

@qiyuangong qiyuangong merged commit e813142 into qiyuangong:master Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants