Draw out various use cases. We can see that if left < right then left is the minimum. Do a binary search. If r < m then search right half. Otherwise if m < l search left half. The one complication is duplicate values. If we have a situation where l == m == r then we need to step forward l and step back r until l,m,r are not the same.
-
Recent Posts
Recent Comments
Archives
Categories
Meta