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

 

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

Write a method that returns the number of times the 'find' string occurs inside the 'orig' string. It is OK for occurrences to overlap. Please note that the 'find' string may be any length relative to the 'orig' string, which also may be any length. If the 'find' string is longer than the 'orig' string you must return zero for the number of occurrences since you can't fit a bigger string into a smaller one. The 'find' string will NOT be an empty string.


cedarStringCount("abbabbabbabbabbabba", "abba") → 6
cedarStringCount("What we look for in a week we find weakly", "we") → 4
cedarStringCount("", "cow") → 0

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

public int cedarStringCount(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: 280

Copyright Nick Parlante 2017 - privacy