Question: in java please Java Python scaredyCat An array list contains a list of pets that are following each other to a big pet party. The
Java Python scaredyCat An array list contains a list of pets that are following each other to a big pet party. 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 array list. Return the array list of pets. scaredyCat(["cat", "dog", "guinea pig"]) - ["cat", "dog", "guinea pig"] scaredyCat(["cat", "frog", "cat", "dog", "cat"]) - ("cat", "frog", "cat", "dog"] scaredyCat(["cat", "dog", "cat", "cat", "snake"]) - ("cat", "dog", "snake"]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
