LeetCode solutions

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

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 32ms, memory 17.2MB, accepted 2026-01-01.

python
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)

Source