2022-03-27 20:45:09 +08:00
< p > You are given < code > coordinates< / code > , a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference.< / p >
< p > < img alt = "" src = "https://assets.leetcode.com/uploads/2021/02/19/screenshot-2021-02-20-at-22159-pm.png" style = "width: 400px; height: 396px;" / > < / p >
< p > Return < code > true< / code > < em > if the square is white, and < / em > < code > false< / code > < em > if the square is black< / em > .< / p >
< p > The coordinate will always represent a valid chessboard square. The coordinate will always have the letter first, and the number second.< / p >
< p > < / p >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 1:< / strong > < / p >
2022-03-27 20:45:09 +08:00
< pre >
< strong > Input:< / strong > coordinates = " a1"
< strong > Output:< / strong > false
< strong > Explanation:< / strong > From the chessboard above, the square with coordinates " a1" is black, so return false.
< / pre >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 2:< / strong > < / p >
2022-03-27 20:45:09 +08:00
< pre >
< strong > Input:< / strong > coordinates = " h3"
< strong > Output:< / strong > true
< strong > Explanation:< / strong > From the chessboard above, the square with coordinates " h3" is white, so return true.
< / pre >
2023-12-09 18:42:21 +08:00
< p > < strong class = "example" > Example 3:< / strong > < / p >
2022-03-27 20:45:09 +08:00
< pre >
< strong > Input:< / strong > coordinates = " c7"
< strong > Output:< / strong > false
< / pre >
< p > < / p >
< p > < strong > Constraints:< / strong > < / p >
< ul >
< li > < code > coordinates.length == 2< / code > < / li >
< li > < code > ' a' < = coordinates[0] < = ' h' < / code > < / li >
< li > < code > ' 1' < = coordinates[1] < = ' 8' < / code > < / li >
< / ul >