X415: pickTrail

Your task is to write a Jeroo method that will pick an entire trail of flowers. Assume the Jeroo is already standing on the first flower of the trail. Each subsequent flower on the trail could be in front, to the left, or to the right of the Jeroo's current position. Your method should continue to hop and pick flowers, turning as necessary to follow the trail, until it has picked all of the flowers. The jeroo should end at the position of the last flower that was picked. Here is an example trail of flowers (island sizes and flower trails can vary each time the method is called):

Examples:

Island shown in question

Your Answer:

Feedback

Your feedback will appear here when you check your answer.