aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--01/1.rkt (renamed from advent-of-code/2023/01/1.rkt)2
-rw-r--r--01/2.rkt (renamed from advent-of-code/2023/01/2.rkt)2
-rw-r--r--02/1.rkt (renamed from advent-of-code/2023/02/1.rkt)2
-rw-r--r--02/2.rkt (renamed from advent-of-code/2023/02/2.rkt)2
-rw-r--r--03/1.rkt (renamed from advent-of-code/2023/03/1.rkt)4
-rw-r--r--03/2.rkt (renamed from advent-of-code/2023/03/2.rkt)4
-rw-r--r--04/1.rkt (renamed from advent-of-code/2023/04/1.rkt)4
-rw-r--r--04/2.rkt (renamed from advent-of-code/2023/04/2.rkt)4
-rwxr-xr-x05/1.rkt (renamed from advent-of-code/2023/05/1.rkt)0
-rwxr-xr-x05/2.rkt (renamed from advent-of-code/2023/05/2.rkt)0
-rw-r--r--06/1.rkt (renamed from advent-of-code/2023/06/1.rkt)0
-rw-r--r--06/2.rkt (renamed from advent-of-code/2023/06/2.rkt)0
-rw-r--r--07/1.rkt (renamed from advent-of-code/2023/07/1.rkt)0
-rw-r--r--07/2.rkt (renamed from advent-of-code/2023/07/2.rkt)0
-rw-r--r--08/1.rkt (renamed from advent-of-code/2023/08/1.rkt)2
-rw-r--r--08/2.rkt (renamed from advent-of-code/2023/08/2.rkt)2
-rw-r--r--09/1.rkt (renamed from advent-of-code/2023/09/1.rkt)2
-rw-r--r--09/2.rkt (renamed from advent-of-code/2023/09/2.rkt)2
-rw-r--r--10/1.rkt (renamed from advent-of-code/2023/10/1.rkt)2
-rw-r--r--10/2.rkt (renamed from advent-of-code/2023/10/2.rkt)2
-rw-r--r--README.md4
-rw-r--r--advent-of-code/2023/.gitignore1
-rw-r--r--codewars/6-kyu/pyramid-array/solution.rkt14
-rw-r--r--codewars/7-kyu/a-rule-of-divisibility-by-7/solution.rkt15
-rw-r--r--leetcode/1-two-sum/solution.rkt16
-rw-r--r--leetcode/20-valid-parentheses/solution.rkt33
-rw-r--r--lib/obj.rkt (renamed from advent-of-code/lib/obj.rkt)0
-rw-r--r--lib/utils.rkt (renamed from advent-of-code/lib/utils.rkt)0
-rw-r--r--test junk/junk0
30 files changed, 21 insertions, 99 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3f9177e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+input
diff --git a/advent-of-code/2023/01/1.rkt b/01/1.rkt
index 8953e84..82c109b 100644
--- a/advent-of-code/2023/01/1.rkt
+++ b/01/1.rkt
@@ -1,6 +1,6 @@
#lang racket
-(require "../../lib/utils.rkt")
+(require "../lib/utils.rkt")
(define fp (open-input-file "input"))
diff --git a/advent-of-code/2023/01/2.rkt b/01/2.rkt
index f39d87c..1f43996 100644
--- a/advent-of-code/2023/01/2.rkt
+++ b/01/2.rkt
@@ -1,6 +1,6 @@
#lang racket
-(require "../../lib/utils.rkt")
+(require "../lib/utils.rkt")
(define fp (open-input-file "input"))
diff --git a/advent-of-code/2023/02/1.rkt b/02/1.rkt
index 500e916..3ccd4ad 100644
--- a/advent-of-code/2023/02/1.rkt
+++ b/02/1.rkt
@@ -1,6 +1,6 @@
#lang racket
-(require "../../lib/utils.rkt")
+(require "../lib/utils.rkt")
(define fp (open-input-file "input"))
diff --git a/advent-of-code/2023/02/2.rkt b/02/2.rkt
index 7da2cd2..0d680ac 100644
--- a/advent-of-code/2023/02/2.rkt
+++ b/02/2.rkt
@@ -1,6 +1,6 @@
#lang racket
-(require "../../lib/utils.rkt")
+(require "../lib/utils.rkt")
(define fp (open-input-file "input"))
diff --git a/advent-of-code/2023/03/1.rkt b/03/1.rkt
index 5e86227..55a4281 100644
--- a/advent-of-code/2023/03/1.rkt
+++ b/03/1.rkt
@@ -1,7 +1,7 @@
#lang racket
-(require "../../lib/utils.rkt")
-(require "../../lib/obj.rkt")
+(require "../lib/utils.rkt")
+(require "../lib/obj.rkt")
(define (read-input)
(call-with-input-file "input"
diff --git a/advent-of-code/2023/03/2.rkt b/03/2.rkt
index 71c3221..238ed2c 100644
--- a/advent-of-code/2023/03/2.rkt
+++ b/03/2.rkt
@@ -1,7 +1,7 @@
#lang racket
-(require "../../lib/utils.rkt")
-(require "../../lib/obj.rkt")
+(require "../lib/utils.rkt")
+(require "../lib/obj.rkt")
(define (read-input)
(call-with-input-file "input"
diff --git a/advent-of-code/2023/04/1.rkt b/04/1.rkt
index e8dd242..e5bae92 100644
--- a/advent-of-code/2023/04/1.rkt
+++ b/04/1.rkt
@@ -1,7 +1,7 @@
#lang racket
-(require "../../lib/utils.rkt")
-(require "../../lib/obj.rkt")
+(require "../lib/utils.rkt")
+(require "../lib/obj.rkt")
(define fp (open-input-file "input"))
diff --git a/advent-of-code/2023/04/2.rkt b/04/2.rkt
index eec9632..97977ec 100644
--- a/advent-of-code/2023/04/2.rkt
+++ b/04/2.rkt
@@ -1,7 +1,7 @@
#lang racket
-(require "../../lib/utils.rkt")
-(require "../../lib/obj.rkt")
+(require "../lib/utils.rkt")
+(require "../lib/obj.rkt")
(define fp (open-input-file "input"))
diff --git a/advent-of-code/2023/05/1.rkt b/05/1.rkt
index 352e10c..352e10c 100755
--- a/advent-of-code/2023/05/1.rkt
+++ b/05/1.rkt
diff --git a/advent-of-code/2023/05/2.rkt b/05/2.rkt
index 8e39c40..8e39c40 100755
--- a/advent-of-code/2023/05/2.rkt
+++ b/05/2.rkt
diff --git a/advent-of-code/2023/06/1.rkt b/06/1.rkt
index 5496476..5496476 100644
--- a/advent-of-code/2023/06/1.rkt
+++ b/06/1.rkt
diff --git a/advent-of-code/2023/06/2.rkt b/06/2.rkt
index 2d666ed..2d666ed 100644
--- a/advent-of-code/2023/06/2.rkt
+++ b/06/2.rkt
diff --git a/advent-of-code/2023/07/1.rkt b/07/1.rkt
index 286a0e8..286a0e8 100644
--- a/advent-of-code/2023/07/1.rkt
+++ b/07/1.rkt
diff --git a/advent-of-code/2023/07/2.rkt b/07/2.rkt
index 07ff61b..07ff61b 100644
--- a/advent-of-code/2023/07/2.rkt
+++ b/07/2.rkt
diff --git a/advent-of-code/2023/08/1.rkt b/08/1.rkt
index 81424a1..91dbcea 100644
--- a/advent-of-code/2023/08/1.rkt
+++ b/08/1.rkt
@@ -1,6 +1,6 @@
#lang racket
-(require "../../lib/utils.rkt")
+(require "../lib/utils.rkt")
(define lines
(call-with-input-file "input"
diff --git a/advent-of-code/2023/08/2.rkt b/08/2.rkt
index c0c55ea..a56d874 100644
--- a/advent-of-code/2023/08/2.rkt
+++ b/08/2.rkt
@@ -1,6 +1,6 @@
#lang racket
-(require "../../lib/utils.rkt")
+(require "../lib/utils.rkt")
(define lines
(call-with-input-file "input"
diff --git a/advent-of-code/2023/09/1.rkt b/09/1.rkt
index 531c5dd..6623096 100644
--- a/advent-of-code/2023/09/1.rkt
+++ b/09/1.rkt
@@ -1,6 +1,6 @@
#lang racket
-(require "../../lib/utils.rkt")
+(require "../lib/utils.rkt")
(define lines
(call-with-input-file "input"
diff --git a/advent-of-code/2023/09/2.rkt b/09/2.rkt
index b747b97..5c25482 100644
--- a/advent-of-code/2023/09/2.rkt
+++ b/09/2.rkt
@@ -1,6 +1,6 @@
#lang racket
-(require "../../lib/utils.rkt")
+(require "../lib/utils.rkt")
(define lines
(call-with-input-file "input"
diff --git a/advent-of-code/2023/10/1.rkt b/10/1.rkt
index e4911aa..3d9801c 100644
--- a/advent-of-code/2023/10/1.rkt
+++ b/10/1.rkt
@@ -1,6 +1,6 @@
#lang racket
-(require "../../lib/utils.rkt")
+(require "../lib/utils.rkt")
(define lines
(call-with-input-file "input"
diff --git a/advent-of-code/2023/10/2.rkt b/10/2.rkt
index 3653a94..0d9c5a6 100644
--- a/advent-of-code/2023/10/2.rkt
+++ b/10/2.rkt
@@ -1,6 +1,6 @@
#lang racket
-(require "../../lib/utils.rkt")
+(require "../lib/utils.rkt")
(define lines
(call-with-input-file "input"
diff --git a/README.md b/README.md
index 83d6336..f23289c 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,3 @@
-# Practice
+# Advent of Code 2023 in Racket
-This code repository is the records of my solutions to problems on websites such as Advent of Code and CodeWars. Many of the problems are at the beginner level, so this code repository may have limited utility for others.
+My solutions of [Advent of Code 2023](https://adventofcode.com/2023) in [Racket](https://racket-lang.org/).
diff --git a/advent-of-code/2023/.gitignore b/advent-of-code/2023/.gitignore
deleted file mode 100644
index 770eab4..0000000
--- a/advent-of-code/2023/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-input \ No newline at end of file
diff --git a/codewars/6-kyu/pyramid-array/solution.rkt b/codewars/6-kyu/pyramid-array/solution.rkt
deleted file mode 100644
index 0d6a00b..0000000
--- a/codewars/6-kyu/pyramid-array/solution.rkt
+++ /dev/null
@@ -1,14 +0,0 @@
-#lang racket
-
-;; https://www.codewars.com/kata/515f51d438015969f7000013
-
-(provide pyramid)
-
-(define (pyramid n)
- (define (loop ret level cur)
- (define next (cons 1 cur))
- (if (= level n)
- (reverse ret)
- (loop (cons next ret) (+ level 1) next)))
- (loop '() 0 '()))
-
diff --git a/codewars/7-kyu/a-rule-of-divisibility-by-7/solution.rkt b/codewars/7-kyu/a-rule-of-divisibility-by-7/solution.rkt
deleted file mode 100644
index 6859107..0000000
--- a/codewars/7-kyu/a-rule-of-divisibility-by-7/solution.rkt
+++ /dev/null
@@ -1,15 +0,0 @@
-#lang racket
-
-;; https://www.codewars.com/kata/55e6f5e58f7817808e00002e
-
-(provide seven)
-
-(define (seven m)
- (define (impl cur steps)
- (define x (quotient cur 10))
- (define y (modulo cur 10))
- (define next (- x (* 2 y)))
- (if (< cur 100)
- (cons cur steps)
- (impl next (+ 1 steps))))
- (impl m 0))
diff --git a/leetcode/1-two-sum/solution.rkt b/leetcode/1-two-sum/solution.rkt
deleted file mode 100644
index e155160..0000000
--- a/leetcode/1-two-sum/solution.rkt
+++ /dev/null
@@ -1,16 +0,0 @@
-#lang racket
-
-;; https://leetcode.com/problems/two-sum/description/
-
-(define/contract (two-sum nums target)
- (-> (listof exact-integer?) exact-integer? (listof exact-integer?))
- (define h (make-hash))
- (define (loop nums index)
- (define n (car nums))
- (define diff (- target n))
- (if (hash-has-key? h diff)
- (list index (hash-ref h diff))
- (let ()
- (hash-set! h n index)
- (loop (cdr nums) (+ 1 index)))))
- (loop nums 0))
diff --git a/leetcode/20-valid-parentheses/solution.rkt b/leetcode/20-valid-parentheses/solution.rkt
deleted file mode 100644
index 559b90c..0000000
--- a/leetcode/20-valid-parentheses/solution.rkt
+++ /dev/null
@@ -1,33 +0,0 @@
-#lang racket
-
-;; https://leetcode.com/problems/valid-parentheses/
-
-(define (is-left-paren c)
- (or (eq? c #\u28)
- (eq? c #\[)
- (eq? c #\{)))
-
-(define (right-paren c)
- (cond ((eq? c #\u28) #\u29)
- ((eq? c #\[) #\])
- ((eq? c #\{) #\})))
-
-(define/contract (is-valid s)
- (-> string? boolean?)
- (define (loop s stack)
- (if (= 0 (string-length s))
- (null? stack)
- (let ()
- (define c (string-ref s 0))
- (define remain (substring s 1))
- (if (is-left-paren c)
- (loop remain (cons c stack))
- (if (null? stack)
- #f
- (let ()
- (define stack-top (car stack))
- (if (eq? c (right-paren stack-top))
- (loop remain (cdr stack))
- #f)))))))
- (loop s '()))
-
diff --git a/advent-of-code/lib/obj.rkt b/lib/obj.rkt
index 8ffc401..8ffc401 100644
--- a/advent-of-code/lib/obj.rkt
+++ b/lib/obj.rkt
diff --git a/advent-of-code/lib/utils.rkt b/lib/utils.rkt
index 2ce8a51..2ce8a51 100644
--- a/advent-of-code/lib/utils.rkt
+++ b/lib/utils.rkt
diff --git a/test junk/junk b/test junk/junk
deleted file mode 100644
index e69de29..0000000
--- a/test junk/junk
+++ /dev/null