This is useful for binary search, btw. If you are looking for a transition point, you want to stop when the two pointers are next to each other.

i.e., keep going while # of elements between l and r > 0

i.e., while sleepy cat > 0 x.com/Nil053/status/1953248646503559547