aboutsummaryrefslogtreecommitdiff
path: root/racket/leetcode/lc-1812-chessboard-square.rkt
diff options
context:
space:
mode:
Diffstat (limited to 'racket/leetcode/lc-1812-chessboard-square.rkt')
-rw-r--r--racket/leetcode/lc-1812-chessboard-square.rkt7
1 files changed, 7 insertions, 0 deletions
diff --git a/racket/leetcode/lc-1812-chessboard-square.rkt b/racket/leetcode/lc-1812-chessboard-square.rkt
new file mode 100644
index 0000000..206392c
--- /dev/null
+++ b/racket/leetcode/lc-1812-chessboard-square.rkt
@@ -0,0 +1,7 @@
+#lang racket
+(define/contract (square-is-white coordinates)
+ (-> string? boolean?)
+ (define file (first (string->list coordinates)))
+ (define rank (second (string->list coordinates)))
+ (or (and (odd? (char->integer file)) (even? (char->integer rank)))
+ (and (even? (char->integer file)) (odd? (char->integer rank))))) \ No newline at end of file