6 kyu
Infected Zeroes
282marbiru
Description:
In this kata, the number 0 is infected. You are given a list. Every turn, any item in the list that is adjacent to a 0 becomes infected and transforms into a 0. How many turns will it take for the whole list to become infected?
[0,1,1,0] ==> [0,0,0,0]
All infected in 1 turn.
[1,1,0,1,1] --> [1,0,0,0,1] --> [0,0,0,0,0]
All infected in 2 turns
[0,1,1,1] --> [0,0,1,1] --> [0,0,0,1] --> [0,0,0,0]
All infected in 3 turns.
All lists will contain at least one item, and at least one zero, and the only items will be 0s and 1s. Lists may be very very long, so pure brute force approach will not work.
Fundamentals
Similar Kata:
Stats:
Created | Jan 6, 2018 |
Published | Jan 6, 2018 |
Warriors Trained | 933 |
Total Skips | 21 |
Total Code Submissions | 2469 |
Total Times Completed | 282 |
Python Completions | 282 |
Total Stars | 35 |
% of votes with a positive feedback rating | 94% of 89 |
Total "Very Satisfied" Votes | 79 |
Total "Somewhat Satisfied" Votes | 10 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 7 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |