Skip to content

Commit c3d337d

Browse files
authored
Improved task 3001
1 parent 5570e51 commit c3d337d

File tree

1 file changed

+3
-3
lines changed
  • src/main/java/g3001_3100/s3001_minimum_moves_to_capture_the_queen

1 file changed

+3
-3
lines changed

src/main/java/g3001_3100/s3001_minimum_moves_to_capture_the_queen/Solution.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
public class Solution {
66
public int minMovesToCaptureTheQueen(int a, int b, int c, int d, int e, int f) {
77
if (a == e || b == f) {
8-
if (a == c && ((d > b && d < f) || (d > f && d < b))) {
8+
if (a == c && (d > b && d < f || d > f && d < b)) {
99
return 2;
1010
}
11-
if (b == d && ((c > a && c < e) || (c > e && c < a))) {
11+
if (b == d && (c > a && c < e || c > e && c < a)) {
1212
return 2;
1313
}
1414
return 1;
1515
} else if (Math.abs(c - e) == Math.abs(d - f)) {
1616
if (Math.abs(a - c) == Math.abs(b - d)
1717
&& Math.abs(e - a) == Math.abs(f - b)
18-
&& ((a > e && a < c) || (a > c && a < e))) {
18+
&& (a > e && a < c || a > c && a < e)) {
1919
return 2;
2020
}
2121
return 1;

0 commit comments

Comments
 (0)