Class Solution
-
- All Implemented Interfaces:
public final class Solution3274 - Check if Two Chessboard Squares Have the Same Color\.
Easy
You are given two strings,
coordinate1andcoordinate2, representing the coordinates of a square on an8 x 8chessboard.Below is the chessboard for reference.
Return
trueif these two squares have the same color andfalseotherwise.The coordinate will always represent a valid chessboard square. The coordinate will always have the letter first (indicating its column), and the number second (indicating its row).
Example 1:
Input: coordinate1 = "a1", coordinate2 = "c3"
Output: true
Explanation:
Both squares are black.
Example 2:
Input: coordinate1 = "a1", coordinate2 = "h3"
Output: false
Explanation:
Square
"a1"is black and"h3"is white.Constraints:
coordinate1.length == coordinate2.length == 2'a' <= coordinate1[0], coordinate2[0] <= 'h''1' <= coordinate1[1], coordinate2[1] <= '8'
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final BooleancheckTwoChessboards(String coordinate1, String coordinate2)-
-
Method Detail
-
checkTwoChessboards
final Boolean checkTwoChessboards(String coordinate1, String coordinate2)
-
-
-
-