Skip to content

Commit ee8de72

Browse files
committed
Add solution #1812
1 parent 7bfb653 commit ee8de72

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@
264264
1748|[Sum of Unique Elements](./1748-sum-of-unique-elements.js)|Easy|
265265
1780|[Check if Number is a Sum of Powers of Three](./1780-check-if-number-is-a-sum-of-powers-of-three.js)|Medium|
266266
1791|[Find Center of Star Graph](./1791-find-center-of-star-graph.js)|Easy|
267+
1812|[Determine Color of a Chessboard Square](./1812-determine-color-of-a-chessboard-square.js)|Easy|
267268
1832|[Check if the Sentence Is Pangram](./1832-check-if-the-sentence-is-pangram.js)|Easy|
268269
1880|[Check if Word Equals Summation of Two Words](./1880-check-if-word-equals-summation-of-two-words.js)|Easy|
269270
1886|[Determine Whether Matrix Can Be Obtained By Rotation](./1886-determine-whether-matrix-can-be-obtained-by-rotation.js)|Easy|
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* 1812. Determine Color of a Chessboard Square
3+
* https://leetcode.com/problems/determine-color-of-a-chessboard-square/
4+
* Difficulty: Easy
5+
*
6+
* You are given coordinates, a string that represents the coordinates of a square of
7+
* the chessboard. Below is a chessboard for your reference.
8+
*
9+
* Return true if the square is white, and false if the square is black.
10+
*
11+
* The coordinate will always represent a valid chessboard square. The coordinate will
12+
* always have the letter first, and the number second.
13+
*/
14+
15+
/**
16+
* @param {string} coordinates
17+
* @return {boolean}
18+
*/
19+
var squareIsWhite = function(coordinates) {
20+
const [x, y] = coordinates;
21+
return (x.charCodeAt() + +y) % 2 !== 0;
22+
};

0 commit comments

Comments
 (0)