Clojure Tidbits - Consecutive elements in a sequence?
I have recently come across an interesting question that need to be solved using functional programming techniques. So I thought, I shall give it a shot in clojure.
How do you determine if all the elements in a given sequence are all consecutive elements?
- Sort the sequence
- Compare each element with the next element & it should differ by 1.