aboutsummaryrefslogtreecommitdiff
path: root/leetcode/lc-1221-split-a-string-balanced.rkt
diff options
context:
space:
mode:
Diffstat (limited to 'leetcode/lc-1221-split-a-string-balanced.rkt')
-rw-r--r--leetcode/lc-1221-split-a-string-balanced.rkt19
1 files changed, 0 insertions, 19 deletions
diff --git a/leetcode/lc-1221-split-a-string-balanced.rkt b/leetcode/lc-1221-split-a-string-balanced.rkt
deleted file mode 100644
index 4c75770..0000000
--- a/leetcode/lc-1221-split-a-string-balanced.rkt
+++ /dev/null
@@ -1,19 +0,0 @@
-#lang racket
-(require rackunit)
-
-(define/contract (balanced-string-split s)
- (-> string? exact-integer?)
- (for/fold ([acc 0]
- [count 0]
- #:result count)
- ([c (string->list s)])
- (let* ([increment (case c
- [(#\R) 1]
- [(#\L) -1])]
- [new-acc (+ increment acc)]
- [new-count (case new-acc
- [(0) (add1 count)]
- [else count])])
- (values new-acc new-count))))
-
-(check-eq? (balanced-string-split "RLRRLLRLRL") 4) \ No newline at end of file