I'll give you problems requiring bounds. Find the number of elements in range in a sorted vector using the difference between upper and lower bounds. You'll use: upper_bound(v.begin(), v.end(), R) - lower_bound(v.begin(), v.end(), L) to count elements where .
This runs in time. Try variants: count elements less than , greater than , or exactly equal to . Each uses different combinations of lower_bound and upper_bound.