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

 

 

Warmup 1Searching3

prev  |  next  |  chance
public static boolean search(String a, String b, String c) {
    int len = c.length();
    boolean found1 = false;
    boolean found2 = false;

    if (a.contains(c))
        found1 = true;

    if (b.indexOf(c) != -1)
        found2 = true;

    return found1 && found2;
}
Function Call  Return Value
search("Hello", "World", "!")
search("Hello", "World", "o")
search("Bohemian", "Rhapsody", "a")
search("!!", "??", "aaaa")
search("Computational", "Thinking", "i")
search("Ok...", "Then...", "...")

Experiment with this code on Gitpod.io

⬅ Back