Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Generatedi1 solution in Uncategorized category for Spaceship Landing Strip by dougall
def checkio(themap):
l = []
for y1 in range(len(themap)):
for x1 in range(len(themap[0])):
for y2 in range(y1, len(themap)):
for x2 in range(x1, len(themap[0])):
if all(x in 'GS' for x in ''.join([v[x1:x2+1] for v in themap[y1:y2+1]])):
l.append((y2-y1+1)*(x2-x1+1))
return max(l)
if __name__ == '__main__':
assert checkio(['G']) == 1, 'First'
assert checkio(['GS','GS']) == 4, 'Second'
assert checkio(['GT','GG']) == 2, 'Third'
assert checkio(['GGTGG','TGGGG','GSSGT','GGGGT','GWGGG','RGTRT','RTGWT','WTWGR']) == 9, 'Fourth'
print('All is ok')
Oct. 27, 2012
Comments: