Skip to content

Commit fd23399

Browse files
authored
Added Determine Color of a Chessboard Square.java
1 parent f48cd08 commit fd23399

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution {
2+
public boolean squareIsWhite(String coordinates) {
3+
return (
4+
("aceg".indexOf(coordinates.charAt(0)) != -1
5+
&& Character.getNumericValue(coordinates.charAt(1)) % 2 == 0) ||
6+
("aceg".indexOf(coordinates.charAt(0)) == -1
7+
&& Character.getNumericValue(coordinates.charAt(1)) % 2 != 0)
8+
);
9+
}
10+
}

0 commit comments

Comments
 (0)