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

Function search

javascript/0213-house-robber-ii.js:21–35  ·  view source on GitHub ↗
(nums, start, end)

Source from the content-addressed store, hash-verified

19};
20
21const search = (nums, start, end) => {
22 let [left, mid] = [0, 0];
23
24 for (let i = start; i <= end; i++) {
25 /* Time O(N) */
26 const temp = mid;
27 const right = nums[i];
28 const house = left + right;
29
30 mid = Math.max(mid, house);
31 left = temp;
32 }
33
34 return mid;
35};

Callers 1

robFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected