What if we use upperbound in case of lowerbound in this problem it is working the same

It is working the same as it was working with lower bound