Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Dangerous Bishops by StefanPochmann
def safe_squares(n, bishops):
D, E = set(), set()
for i, j in bishops:
D.add(i + j)
E.add(i - j)
return sum(
i + j not in D and
i - j not in E
for i in range(n)
for j in range(n)
)
May 22, 2024
Comments: