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

 

apcsaListFindTarget


Given an ArrayList of Strings and a target String, return an ArrayList of String values which only has entries containing the target String in them somewhere. Try doing this problem first with an indexed for loop using the remove() method of ArrayList. After you solve that, try reversing the direction of the loop control variable. After you solve it a second time, try it again using an enhanced for (a.k.a. a for-each) loop.


apcsaListFindTarget(["out of time and out of", "darkness", "sometimes will occur", "the light"], "me") → ["out of time and out of", "sometimes will occur"]
apcsaListFindTarget(["hey ho", "ha ha", "har har", "the Hardy boys"], "ha") → ["ha ha", "har har"]
apcsaListFindTarget(["start", "middle", "end"], "e") → ["middle", "end"]

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

public List<String> apcsaListFindTarget(ArrayList<String> lst, String target) { }

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

Copyright Nick Parlante 2017 - privacy