3274. Check if Two Chessboard Squares Have the Same Color Easy

@problem@discussion
#Math#String



1/**
2 * [3274] Check if Two Chessboard Squares Have the Same Color
3 *
4 * You are given two strings, coordinate1 and coordinate2, representing the coordinates of a square on an 8 x 8 chessboard.
5 * Below is the chessboard for reference.
6 * <img alt="" src="https://assets.leetcode.com/uploads/2024/07/17/screenshot-2021-02-20-at-22159-pm.png" style="width: 400px; height: 396px;" />
7 * Return true if these two squares have the same color and false otherwise.
8 * 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).
9 *  
10 * <strong class="example">Example 1:
11 * <div class="example-block">
12 * Input: <span class="example-io">coordinate1 = "a1", coordinate2 = "c3"</span>
13 * Output: <span class="example-io">true</span>
14 * Explanation:
15 * Both squares are black.
16 * </div>
17 * <strong class="example">Example 2:
18 * <div class="example-block">
19 * Input: <span class="example-io">coordinate1 = "a1", coordinate2 = "h3"</span>
20 * Output: <span class="example-io">false</span>
21 * Explanation:
22 * Square "a1" is black and "h3" is white.
23 * </div>
24 *  
25 * Constraints:
26 * 
27 * 	coordinate1.length == coordinate2.length == 2
28 * 	'a' <= coordinate1[0], coordinate2[0] <= 'h'
29 * 	'1' <= coordinate1[1], coordinate2[1] <= '8'
30 * 
31 */
32pub struct Solution {}
33
34// problem: https://leetcode.com/problems/check-if-two-chessboard-squares-have-the-same-color/
35// discuss: https://leetcode.com/problems/check-if-two-chessboard-squares-have-the-same-color/discuss/?currentPage=1&orderBy=most_votes&query=
36
37// submission codes start here
38
39impl Solution {
40    pub fn check_two_chessboards(coordinate1: String, coordinate2: String) -> bool {
41        false
42    }
43}
44
45// submission codes end
46
47#[cfg(test)]
48mod tests {
49    use super::*;
50
51    #[test]
52    fn test_3274() {
53    }
54}
55


Back
© 2025 bowen.ge All Rights Reserved.