File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change
1
+ #lang racket
2
+
3
+ (define (first-missing-positive nums)
4
+ "https://leetcode.com/problems/first-missing-positive/ "
5
+ (foldl (lambda (num res) (if (= res num) (+ res 1 ) res)) 1 (sort nums <)))
6
+
7
+ (provide first-missing-positive)
Original file line number Diff line number Diff line change 7
7
(require "count-upper.rkt " )
8
8
(require "reverse-integer.rkt " )
9
9
(require "length-of-last-word.rkt " )
10
+ (require "first-missing-positive.rkt " )
10
11
11
12
(check-equal? (two-sum 5 '(1 2 3 4 )) '(1 2 ))
12
13
(check-equal? (two-sum 21 '(0 2 11 19 90 )) '(1 3 ))
30
31
(check-equal? (length-of-last-word "Hello World " ) 5 )
31
32
(check-equal? (length-of-last-word "Hello " ) 0 )
32
33
(check-equal? (length-of-last-word " " ) 0 )
34
+
35
+ (check-equal? (first-missing-positive '(1 2 0 )) 3 )
36
+ (check-equal? (first-missing-positive '(3 4 -1 1 )) 2 )
37
+ (check-equal? (first-missing-positive '(7 8 9 11 12 )) 1 )
You can’t perform that action at this time.
0 commit comments