From c3d337d9d950890039abad6c7decb85b7786b088 Mon Sep 17 00:00:00 2001 From: Valentyn Kolesnikov Date: Sun, 25 Feb 2024 05:40:48 +0200 Subject: [PATCH] Improved task 3001 --- .../s3001_minimum_moves_to_capture_the_queen/Solution.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/g3001_3100/s3001_minimum_moves_to_capture_the_queen/Solution.java b/src/main/java/g3001_3100/s3001_minimum_moves_to_capture_the_queen/Solution.java index b978d34b1..892388c5a 100644 --- a/src/main/java/g3001_3100/s3001_minimum_moves_to_capture_the_queen/Solution.java +++ b/src/main/java/g3001_3100/s3001_minimum_moves_to_capture_the_queen/Solution.java @@ -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;