MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / binarySearch

Method binarySearch

java/1235-maximum-profit-in-job-scheduling.java:38–53  ·  view source on GitHub ↗
(int[][] intervals, int start, int target)

Source from the content-addressed store, hash-verified

36 }
37
38 private int binarySearch(int[][] intervals, int start, int target) {
39 int left = start + 1;
40 int right = intervals.length - 1;
41
42 while (left <= right) {
43 int mid = left + (right - left) / 2;
44
45 if (intervals[mid][0] < target) {
46 left = mid + 1;
47 } else {
48 right = mid - 1;
49 }
50 }
51
52 return left;
53 }
54}

Callers 2

dfsMethod · 0.95
lengthOfLISMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected