Skip to content

Commit ab37f41

Browse files
refactor 356
1 parent 67ead73 commit ab37f41

File tree

1 file changed

+3
-21
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+3
-21
lines changed

src/main/java/com/fishercoder/solutions/_356.java

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,11 @@
33
import java.util.HashSet;
44
import java.util.Set;
55

6-
/**
7-
* 356. Line Reflection
8-
*
9-
* Given n points on a 2D plane, find if there is such a line parallel to y-axis that reflect the given points.
10-
11-
Example 1:
12-
Given points = [[1,1],[-1,1]], return true.
13-
14-
Example 2:
15-
Given points = [[1,1],[-1,-1]], return false.
16-
17-
Follow up:
18-
Could you do better than O(n2)?
19-
20-
Hint:
21-
22-
Find the smallest and largest x-value for all points.
23-
If there is a line then it should be at y = (minX + maxX) / 2.
24-
For each point, make sure that it has a reflected point in the opposite side.
25-
*/
266
public class _356 {
277
public static class Solution1 {
28-
/** credit: https://discuss.leetcode.com/topic/48172/simple-java-hashset-solution */
8+
/**
9+
* credit: https://discuss.leetcode.com/topic/48172/simple-java-hashset-solution
10+
*/
2911
public boolean isReflected(int[][] points) {
3012
int max = Integer.MIN_VALUE;
3113
int min = Integer.MAX_VALUE;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy