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 (length-of-last-word words)
4
+ "https://leetcode.com/problems/length-of-last-word/ "
5
+ (if (string-suffix? words " " ) 0 (string-length (last (string-split words " " )))))
6
+
7
+ (provide length-of-last-word)
Original file line number Diff line number Diff line change 6
6
(require "remove-dups.rkt " )
7
7
(require "count-upper.rkt " )
8
8
(require "reverse-integer.rkt " )
9
+ (require "length-of-last-word.rkt " )
9
10
10
11
(check-equal? (two-sum 5 '(1 2 3 4 )) '(1 2 ))
11
12
(check-equal? (two-sum 21 '(0 2 11 19 90 )) '(1 3 ))
25
26
(check-equal? (reverse-integer 123 ) 321 )
26
27
(check-equal? (reverse-integer -123 ) -321 )
27
28
(check-equal? (reverse-integer 120 ) 21 )
29
+
30
+ (check-equal? (length-of-last-word "Hello World " ) 5 )
31
+ (check-equal? (length-of-last-word "Hello " ) 0 )
32
+ (check-equal? (length-of-last-word " " ) 0 )
You can’t perform that action at this time.
0 commit comments