Skip to content

Practice Determine Color of a Chessboard Square

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1812
LeetCode Problem

Determine Color of a Chessboard Square

Problem Statement

The 8 by 8 chessboard has columns a through h and rows 1 through 8. Square a1 is black, and horizontally or vertically neighboring squares have opposite colors. Given a valid coordinate with the column letter first and row digit second, return true for a white square and false for a black square.

Source: Determine Color of a Chessboard Square on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
coordinates = "a1"
Output
false

# Example 2

Input
coordinates = "h3"
Output
true

# Example 3

Input
coordinates = "c7"
Output
false

Constraints

coordinates.length == 2
'a' <= coordinates[0] <= 'h'
'1' <= coordinates[1] <= '8'

Related LeetCode Problems

Practice more problems similar to Determine Color of a Chessboard Square.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.