#108
Lazy Searching
Difficulty: | Medium |
Topics: | seqs sorting |
Given any number of sequences,
each sorted from smallest to largest,
find the smallest single number
which appears in all of the sequences.
The sequences may be infinite, so be careful to search lazily.
(= 3 (__ [3 4 5])) | |
(= 4 (__ [1 2 3 4 5 6 7] [0.5 3/2 4 19])) | |
(= 64 (__ (map #(* % % %) (range)) (filter #(zero? (bit-and % (dec %))) (range)) (iterate inc 20))) | |
(= 7 (__ (range) (range 0 100 7/6) [2 3 5 7 11 13])) |