Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
13 lines, for loop solution in Clear category for Pawn Brotherhood by mickas
def safe_pawns(pawns: set) -> int:
safe = 0
pawn_guard_L = ""
pawn_guard_R = ""
for pawn in pawns:
pawn_guard_L = chr(ord(pawn[0]) - 1) + chr(ord(pawn[1]) - 1)
pawn_guard_R = chr(ord(pawn[0]) + 1) + chr(ord(pawn[1]) - 1)
if pawn_guard_L in pawns or pawn_guard_R in pawns:
safe += 1
return safe
July 6, 2020
Comments: