id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

Warmup 1LookForIt

prev  |  next  |  chance
public static boolean lookForIt(String str) {
    int c = 0;

    for (int i = 0; i < str.length(); i++)
        if (str.substring(i, i + 1).equals("a"))
            c++;

    return c >= 2;
}
Function Call  Return Value
lookForIt("aaabbb")
lookForIt("bbba")
lookForIt("aa")
lookForIt("a")
lookForIt("")
lookForIt("hello")

Experiment with this code on Gitpod.io

⬅ Back