In the case when A.get(mid) == A.get(right)
you say that we cannot eliminate either side. We actually can: if A.get(left) != A.get(middle)
then there is no way the breaking point is on the right and we recurse only left.
Only when all 3 elements are equal, we cannot decide where to go and have to cover both.