Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Pawn Brotherhood by PawelBubak
def safe_pawns(pawns):
pawns_indexes = set()
for p in pawns:
rzad = int(p[1])
kol = ord(p[0]) - 96
pawns_indexes.add((rzad, kol))
krok = 0
for rzad, kol in pawns_indexes:
is_safe = ((rzad - 1, kol - 1) in pawns_indexes) or ((rzad - 1, kol + 1) in pawns_indexes)
if is_safe:
krok += 1
return krok
Oct. 29, 2016