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

 

tmhscs@gmail.com lists > list_scaredyCat
prev  |  next  |  chance

Imagine you are given a list of pets that are following each other to a big pet party. IE: The pet at position 0 is following the pet at position 1. If the pet is a cat that is being followed by a dog, it gets scared and runs away, so you should remove it from the list!


list_scaredyCat(["cat", "dog", "guinea pig"]) → ["cat", "dog", "guinea pig"]
list_scaredyCat(["cat", "frog", "cat", "dog", "cat"]) → ["cat", "frog", "cat", "dog"]
list_scaredyCat(["cat", "dog", "cat", "cat", "snake"]) → ["cat", "dog", "snake"]

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

public List<String> list_scaredyCat(List<String> pets) { }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy