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.

Difficulty: introductory

Starter code:

def infected_zeroes(lst):
	

Solutions:
def infected_zeroes(s):
    m=0; l=0
    for i,n in enumerate(s):
        if n==0: m=i if l==0 else max(m, (i-l+1)//2); l=i+1
    return max(m,len(s)-l)

def infected_zeroes(lst):
    left, *enclosed, right = "".join(str(digit) for digit in lst).split("0")
    return max(len(left), len(right), *((len(ones) + 1)//2 for ones in enclosed))

from math import ceil
def infected_zeroes(li):
    zeros = [i for i,j in enumerate(li) if not j]
    l = [ceil((zeros[i+1]-j-1) / 2) for i,j in enumerate(zeros[:-1])]
    return max([zeros[0],len(li)-zeros[-1]-1]+l)

import re

def infected_zeroes(lst):
    return max(((len(m)+1)//2 if s and e else len(m) for s,m,e in re.findall(r'(^|0)(1+)(0|$)', ''.join(map(str,lst)).replace("0","00"))), default=0)

def infected_zeroes(a):
    zeros = [i for i, n in enumerate(a) if not n]
    return len(zeros) and max((y - x) // 2 for x, y in
            zip([-1 - zeros[0]] + zeros, zeros + [2*len(a) -1 - zeros[-1]]))

from math import ceil


def infected_zeroes(lst):
    # convert out list to a string for processing and split on "infected" zeroes
    chunks_of_ones = ''.join([str(l) for l in lst]).split('0')

    longest_chunk_of_ones = max([len(c) for c in chunks_of_ones])

    # if our longest run is the starting or ending chunk, num_turns is going to be the length of that chunk
    # however, all other chunks will be getting infected from both sides, so in those cases we divide by two
    num_turns = max(len(chunks_of_ones[0]), ceil(longest_chunk_of_ones / 2), len(chunks_of_ones[-1]))
    
    return num_turns

def infected_zeroes(a):
    s = ''.join(str(e) for e in a)
    return max([len(w) + 1 for w in s.split('0')] + [s.find('0') * 2, s[::-1].find('0') * 2]) // 2

def infected_zeroes(lst):

    duzinaNiza = len(lst)
    if duzinaNiza == 1:
        return 0
    result = 0
    clanNiza = lst[0]
    br_out = 0
    i = 0
    br_poc = 0
    br_kraj = 0

    while clanNiza == 1 :
        br_out += 1
        i += 1
        clanNiza = lst[i]
    br_poc = br_out

    clanNiza = lst[duzinaNiza - 1]
    br_out = 0
    j = duzinaNiza - 1
    while clanNiza == 1 :
        br_out += 1
        j -= 1
        clanNiza = lst[j]
    br_kraj = br_out

    br_in = 0
    br_sred_par = 0
    br_sred_nepar = 0
    for k in range(i+1, j+1) :
        if lst[k] == 1 :
            br_in += 1
        else:
            if br_in % 2 == 0 :
                if br_sred_par <= br_in :
                    br_sred_par = br_in
                    br_in = 0
            else:
                if br_sred_nepar <= br_in :
                    br_sred_nepar = br_in
                    br_in = 0

    maxOut = 0
    maxIn = 0
    if br_poc > br_kraj :
        maxOut = br_poc
    else:
        maxOut = br_kraj
    if br_sred_nepar > br_sred_par :
        maxIn = br_sred_nepar
    else:
        maxIn = br_sred_par

    if maxIn % 2 == 0 :
        if maxIn / 2 >= maxOut :
            return maxIn//2
        else:
            return maxOut
    else:
        if maxIn // 2 + 1 >= maxOut : 
            return maxIn//2 + 1
        else:
            return maxOut



from re import sub
from math import ceil


def infected_zeroes(lst):
    # convert out list to a string for processing and split on "infected" zeroes
    chunks_of_ones = ''.join([str(l) for l in lst]).split('0')

    longest_chunk_of_ones = max([len(c) for c in chunks_of_ones])

    # if our longest run is the starting or ending chunk, num_turns is going to be the length of that chunk
    # however, all other chunks will be getting infected from both sides, so in those cases we divide by two
    num_turns = max(len(chunks_of_ones[0]), ceil(longest_chunk_of_ones / 2), len(chunks_of_ones[-1]))
    
    return num_turns

def infected_zeroes(lst):
    one = "".join(str(d) for d in lst).split("0")
    return max(len(one[0]), len(one[-1]), *((len(o) + 1)//2 for o in one[1:-1]))