Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Could be shorter? solution in Clear category for The Stone Wall by Merzix
def stone_wall(wall):
thickness = list(map(lambda x: x.count('#'), zip(*wall.splitlines()[1:])))
return thickness.index(min(thickness)) # or numpy.argmax(thickness)
if __name__ == '__main__':
assert stone_wall('''
##########
####0##0##
00##0###00
''') == 4
assert stone_wall('''
#00#######
#######0##
00######00
''') == 1
assert stone_wall('''
#####
#####
#####
''') == 0
assert stone_wall('''
#####
##000
#####
''') == 2
assert stone_wall('''
####0#
#0#00#
#0#0##
''') == 1
Sept. 7, 2018
Comments: