Untitled
unknown
scheme
2 years ago
279 B
10
Indexable
#lang racket
(define/contract (contains-duplicate nums)
(-> (listof exact-integer?) boolean?)
(cond
[(null? nums) (#f)]
[(list? (member (car nums) (cdr nums))) (#t)]
[else (contains-duplicate (cdr nums))])
)
(contains-duplicate '(1 2 3 4 5))Editor is loading...
Leave a Comment