3553. Check if Two Chessboard Squares Have the Same Color
My accepted Python solution to LeetCode problem 3553, Check if Two Chessboard Squares Have the Same Color, running in 32ms.
- Difficulty: Easy
- Python
- Runtime 32ms
- Memory 17.2MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 32ms, memory 17.2MB, accepted 2026-01-01.
class Solution:
def checkTwoChessboards(self, coordinate1: str, coordinate2: str) -> bool:
def get_color(coord):
col = ord(coord[0]) - ord('a')
row = int(coord[1]) - 1
return (col + row) % 2
return get_color(coordinate1) == get_color(coordinate2)