Skip to content

Commit 606ca41

Browse files
add FlyingDrones2D solution
1 parent 770dc7d commit 606ca41

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

easy200/FlyingDrones2D.java

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package easy200;
2+
3+
public class FlyingDrones2D {
4+
5+
public int Manh(int x1, int y1, int x2, int y2) {
6+
return (Math.abs(x1 - x2) + Math.abs(y1 - y2)) / 2 + (Math.abs(x1 - x2) + Math.abs(y1 - y2)) % 2;
7+
}
8+
9+
public int findMinTime(int[] positions_x, int[] positions_y) {
10+
11+
int dist = 0;
12+
13+
for (int i = 0; i < positions_x.length; i++)
14+
for (int j = 0; j < positions_x.length; j++)
15+
dist = Math.max(dist, Manh(positions_x[i], positions_y[i], positions_x[j], positions_y[j]));
16+
17+
return dist;
18+
}
19+
}

0 commit comments

Comments
 (0)