blob: 1b4d107c8aaa5b84b4001277b81a43cc9144dd2d (
plain)
1
2
3
4
5
6
7
8
9
10
|
#lang racket
(define/contract (unique-occurrences arr)
(-> (listof exact-integer?) boolean?)
(define occurrences (make-hash))
(for ([n (in-list arr)])
(hash-update! occurrences n add1 1))
(equal? (hash-values occurrences)
(remove-duplicates (hash-values occurrences))))
(unique-occurrences '(1 2 2 1 1 3))
|