There are functions named
floor in Java’s TreeSet. However I didn’t find something like them in Scala’s TreeSet.
I use code like
set.from(123).min to do such thing. However in this way a new set is created, thus the complexity is
O(n) right? But actually I only need that value, the complexity should be
Is there any function functioning like