<= k
, say given by leq(k)
where k
is an integer, then we can also solve for number of elements = k
, given by eq(k) := leq(k) - leq(k - 1)
. <=k
can be implement as some kind of prefix sum data structure plus binary search, which is much less error prone to hack up than exact equality.