**Solution**

** Line Reflection** https://leetcode.com/problems/line-reflection/

**Algorithm**

- Find the smallest and largest x-value for all points.
- If there is a line then it should be at y = (minX + maxX) / 2.
- For each point, make sure that it has a reflected point in the opposite side.
- How do we find the reflection for a point x? Assume a = (xmin+xmax). Assume reflection of x is xr.
- Now (xmin+xmax)/2 = (x+xr)/2 This gives us: xr = xmin+xmax-x

```
from collections import defaultdict
class Solution(object):
def isReflected(self, points):
"""
:type points: List[List[int]]
:rtype: bool
"""
xmin, xmax, xypoints = float('inf'), float('-inf'), defaultdict(set)
for point in points:
x,y = point[0], point[1]
xypoints[x].add(y)
xmin, xmax = min(xmin, x), max(xmax, x)
a = (xmin+xmax)
for point in points:
x,y = point[0], point[1]
if a - x not in xypoints or y not in xypoints[a - x]:
return False
return True
```