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

Method robHelper

java/0213-house-robber-ii.java:13–22  ·  view source on GitHub ↗
(int[] nums, int start, int end)

Source from the content-addressed store, hash-verified

11 }
12
13 public int robHelper(int[] nums, int start, int end) {
14 int rob1 = 0;
15 int rob2 = 0;
16 for (int i = start; i <= end; i++) {
17 int temp = Math.max(rob1 + nums[i], rob2);
18 rob1 = rob2;
19 rob2 = temp;
20 }
21 return rob2;
22 }
23}

Callers 1

robMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected