Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Pawn Brotherhood by han97
def safe_pawns(pawns):
pawns = {(ord(x[0]) - ord('a'), int(x[1]) - 1) for x in pawns}
number_of_safe = 0
for pawn in pawns:
x, y = pawn
if (x - 1, y - 1) in pawns or (x + 1, y - 1) in pawns:
number_of_safe += 1
return number_of_safe
July 12, 2016