356. Line Reflection
Given n points on a 2D plane, find if there is such a line parallel to y-axis that reflect the given points.
Example 1:
Example 2:
Follow up: Could you do better than O(n2) ?
解题要点:
用set来记录原始point,然后把x轴里最大最小数相加后,再遍历一遍,新的x用相加后的数字减去x,看这个数在不在set里,如不在,返回False。
Last updated
Was this helpful?