We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c21fd8a commit d0eeb0aCopy full SHA for d0eeb0a
solution/0033.Search in Rotated Sorted Array/Solution.java
@@ -3,7 +3,7 @@ public int search(int[] A, int target) {
3
if (A == null || A.length == 0) return -1;
4
int low = 0,high = A.length - 1;
5
while (low <= high) {
6
- int mid = (low + high) / 2;
+ int mid = low + ((high - low) >> 1);
7
if (target < A[mid]) {
8
if (A[mid] >= A[high] && target < A[low]) low = mid + 1;
9
else high = mid - 1;
0 commit comments