Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Algorithms - count

public int countLetterB(String s) {
    int count = 0;
    for (char c: s.toCharArray()) {
        if (c == 'b') {
            count++;
        }
    }
    return count;
}
Source by github.com #
 
PREVIOUS NEXT
Tagged: #Algorithms #count
ADD COMMENT
Topic
Name
3+1 =