Skip to content

Commit

Permalink
Improved task 3001
Browse files Browse the repository at this point in the history
  • Loading branch information
javadev authored Feb 25, 2024
1 parent 5570e51 commit c3d337d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
public class Solution {
public int minMovesToCaptureTheQueen(int a, int b, int c, int d, int e, int f) {
if (a == e || b == f) {
if (a == c && ((d > b && d < f) || (d > f && d < b))) {
if (a == c && (d > b && d < f || d > f && d < b)) {
return 2;
}
if (b == d && ((c > a && c < e) || (c > e && c < a))) {
if (b == d && (c > a && c < e || c > e && c < a)) {
return 2;
}
return 1;
} else if (Math.abs(c - e) == Math.abs(d - f)) {
if (Math.abs(a - c) == Math.abs(b - d)
&& Math.abs(e - a) == Math.abs(f - b)
&& ((a > e && a < c) || (a > c && a < e))) {
&& (a > e && a < c || a > c && a < e)) {
return 2;
}
return 1;
Expand Down

0 comments on commit c3d337d

Please sign in to comment.