Skip to content

Commit c5bbbc8

Browse files
Merge pull request #65 from KartikNP31/master
Create 1812. Determine Color of a Chessboard Square
2 parents 9cdef3d + 772e26d commit c5bbbc8

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)