LeetCode 1812. Determine Color of a Chessboard Square

You are given coordinates, a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference.

Return true if the square is white, and false if the square is black.

The coordinate will always represent a valid chessboard square. The coordinate will always have the letter first, and the number second.

Example 1:

Example 2:

Example 3:

Constraints:

  • coordinates.length == 2

  • 'a' <= coordinates[0] <= 'h'

  • '1' <= coordinates[1] <= '8'

Solution

Last updated

Was this helpful?