Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Pawn Brotherhood by kuzdras
def safe_pawns(pawns: set) -> int:
i = 0
indexes = set()
for p in pawns:
row = int(p[1]) - 1
col = ord(p[0]) - 97
indexes.add((row,col))
for row, col in indexes:
safe = ((row -1, col -1) in indexes) or ((row -1, col + 1) in indexes)
if safe:
i+=1
return i
May 30, 2018