solution to searchRange with my own implementation of lower_bound and upper_bound