This is an assignment that I've been given, it says that if an hash-set contains the values {12, 13, 14, 23, 88, 89, 90, 91}
then they would be represented
as the set of intervals { [12..14], [23..23], [88..91]}
.
Now to the question, should I use for-each for this? I'm kind of confused since I'm not sure if you could group several intervals into 1 set, or should there be different hash-sets?
I did look into some methods like group-by but i don't know if its the right one to use.
Advice or hints are appreciated!