package leetcode;

/**
 * https://leetcode.com/problems/determine-color-of-a-chessboard-square/
 */
public class Problem1812 {
    public boolean squareIsWhite(String coordinates) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem1812 prob = new Problem1812();
        System.out.println(prob.squareIsWhite("a1")); // false
        System.out.println(prob.squareIsWhite("h3")); // true
        System.out.println(prob.squareIsWhite("c7")); // false
    }
}

package leetcode;

/**
 * https://leetcode.com/problems/determine-color-of-a-chessboard-square/
 */
public class Problem1812 {
    public boolean squareIsWhite(String coordinates) {
        return squareIsWhite(
            (coordinates.charAt(0) - 'a') + 1,
            (coordinates.charAt(1) - '0') + 1);
    }

    private static boolean squareIsWhite(int row, int col) {
        if (row % 2 == 0) {
            return col % 2 == 0;
        }
        return col % 2 != 0;
    }
}

Solve problem 1812