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

 

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

Write a method that returns the number of times 'code' appears as part of any of the strings in an array of strings. The string 'code' may appear multiple times in some of the strings, but you are only counting how many strings 'code' appears in, NOT how many times it appears in each string. So count 'code' ONCE as appearing in a string no matter how many times it appears in that string. The only string methods you are allowed to use are: .length, .substring, and .equals.


ppp2hasCode("gni", []) → 0
ppp2hasCode("ing", ["testing", "bling", "sing", "inginging", "bob"]) → 4
ppp2hasCode("dog", ["endogenous", "secundogeniture", "outstanding", "doggerel"]) → 3

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

public int ppp2hasCode(String code, String[] strs) { }

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: 330

Copyright Nick Parlante 2017 - privacy