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

 

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

Write a method that returns the total number of times the string 'find' appears in the string 'orig'. Note that sometimes the matches can overlap. For example, "wowowow" has 3 occurances of "wow" if you allow for overlap (which we are).


smaugCountRepeats("This is a test isn't it?", "is") → 3
smaugCountRepeats("wowowow", "wow") → 3
smaugCountRepeats("wowowowowowowow", "wow") → 7

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

public int smaugCountRepeats(String orig, String find) { }

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: 250 Post-solution available

Copyright Nick Parlante 2017 - privacy