Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Digging a Canal by TovarischZhukov
def check(f, data, checked, i,j):
if (i,j) not in checked and 0<=i=len(data): return None
checked=set(checked)
checked.add(cur)
f={}
if i>0:
check(f, data, checked, i, j+1)
if j>1: check(f, data, checked, i, j-1)
check(f, data, checked, i-1, j)
check(f, data, checked, i+1, j)
if f:
for val in f[min(f.keys())]:
r=find(data, checked, val, path)
if r is not None: retval.append(r)
return min(retval) if retval else None
def checkio(land):
retval=[]
for i in range(len(land[0])):
for j in range(len(land)):
if not(land[j][i]):
r=find(land, set(), (0,i),0)
if r is not None: retval.append(r)
break
return min(retval) if retval else len(land)
Feb. 25, 2016