Skip to content

Commit 76b246f

Browse files
committed
Runtime: 79 ms (Top 69.19%) | Memory: 42.6 MB (Top 17.29%)
1 parent 6801950 commit 76b246f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/algorithms/S/Search in Rotated Sorted Array/Search in Rotated Sorted Array.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 79 ms (Top 69.19%) | Memory: 42.6 MB (Top 17.29%)
12
/**
23
* @param {number[]} nums
34
* @param {number} target
@@ -16,14 +17,14 @@ var search = function(nums, target) {
1617
if (nums[hi] === target) return (hi + h) % len;
1718
break;
1819
}
19-
20+
2021
const i = Math.floor((lo + hi + 1) / 2);
2122
// console.log(lo, hi, i)
2223
const val = nums[i];
2324
if (val === target) return (i + h) % len;
2425
if (val > target) hi = i;
2526
else lo = i;
2627
}
27-
28+
2829
return -1;
29-
};
30+
};

0 commit comments

Comments
 (0)