id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > owlSayWho
prev  |  next  |  chance

Write a method that accepts an array of strings. Count how many times the string "who" or "Who" appears in the array, except do not count a "Who" that comes after another "Who" unless there is at least one "who" between them. For example, {"Who", "who", "who", "Who", "Who", "what", "Who"} has 4 whos that count. The last two "Who"s do not count because they came after a "Who" but before another "who". As another example, {"Who", "what", "jump", who", "who", "run", "Who"} has all 4 count, because a "Who" never follows another "Who" until after a "who".


owlSayWho([]) → 0
owlSayWho(["who"]) → 1
owlSayWho(["Who"]) → 1

...Save, Compile, Run (ctrl-enter)

public int owlSayWho(String[] str) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy