5 kyu
How many Wagons Are in the Train?
115sgerodes
Description:
You are in a Train that is permanently moving in a circle. The Train is looped: The head is connected with the tail and you can go from one to another directly.
Every wagon has a light, you can switch it on and off if you wish.
Count the number of wagons!
You can move between wagons as you wish.
Constraints:
After you count the wagons, the lights in the train should be in the initial state they were in. But at the end you don't need to be in the same wagon where you started.
Use the implemented Train methods:
public boolean isLightOnInCurrentWagon()
public void switchLight()
public void goToNextWagon()
public void goToPreviousWagon()
Train notation "1 : 0 : 0" means that you have a train with three wagons. The light is on in the first wagon and off in the other two.
Algorithms
Puzzles
Lists
Linked Lists
Similar Kata:
Stats:
Created | Dec 16, 2019 |
Published | Dec 16, 2019 |
Warriors Trained | 631 |
Total Skips | 39 |
Total Code Submissions | 1031 |
Total Times Completed | 115 |
Java Completions | 115 |
Total Stars | 15 |
% of votes with a positive feedback rating | 92% of 30 |
Total "Very Satisfied" Votes | 27 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 11 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |