Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 524 Bytes

Question_1812.md

File metadata and controls

21 lines (17 loc) · 524 Bytes

LeetCode Records - Question 1812 Determine Color of a Chessboard Square

Attempt 1:

class Solution {
    public boolean squareIsWhite(String coordinates) {
        int col = coordinates.charAt(0) - 'a' + 1;
        int row = Integer.valueOf(coordinates.charAt(1));

        if ((row % 2 == 0 && col % 2 == 0) || (row % 2 == 1 && col % 2 == 1)) {
            return false;
        }

        return true;
    }
}
  • Runtime: 0 ms (Beats: 100.00%)
  • Memory: 41.19 MB (Beats: 52.38%)