Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
combinations solution in Clear category for Count Squares by kurosawa4434
from itertools import combinations
from math import hypot
def count_squares(points: list[list[int]]) -> int:
return sum(len({hypot(x1 - x2, y1 - y2) for ((x1, y1), (x2, y2)) in combinations(vertices, 2)}) == 2
for vertices in combinations(points, 4))
June 30, 2023