Advertisement
KsaneK

Codility - Diamond Count

Jul 18th, 2019
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. def solution(X, Y):
  2.     points = set((x, y) for (x, y) in zip(X, Y))
  3.     return sum(1 for p1 in points for p2 in filter(lambda p2: p2[0] < p1[0] and p2[1] < p1[1], points) if (2 * p1[0] - p2[0], p2[1]) in points and (p1[0], -p1[1] + 2 * p2[1]) in points)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement