Skip to content

Commit 772e26d

Browse files
authored
Create 1812. Determine Color of a Chessboard Square
Leetcode solution of the question : 1812. Determine Color of a Chessboard Square https://leetcode.com/problems/determine-color-of-a-chessboard-square/
1 parent 19cf890 commit 772e26d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
class Solution {
2+
public boolean squareIsWhite(String coordinates) {
3+
char[] xyCoordinate = coordinates.toCharArray();
4+
if((xyCoordinate[0]-'a')%2 ==0)
5+
{
6+
if(xyCoordinate[1]%2==0)
7+
{
8+
return true;
9+
}else
10+
{
11+
return false;
12+
}
13+
}
14+
else
15+
{
16+
if(xyCoordinate[1]%2==1)
17+
{
18+
return true;
19+
}else
20+
{
21+
return false;
22+
}
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)