```
if len(nums) < 2:
return max(nums)
```

Shouldn’t this be < than 3. If there is only 1 house, no point in finding the max. If there are two hoses, the thief can choose whichever house has more to offer.

This test case:

2 12 9 3 4

returns 16.

The correct answer is 15

This code returns the correct answer:

def rob(nums: List[int]) → int:

odd, even = 0, nums[0]

for i in range(1, len(nums)):

if i % 2 == 0:

even += nums[i]

else:

odd += nums[i]

return max(odd, even)

16 is the correct answer

Both @Fixer and @am are right, one can rob house 12 and 4, totaling 16. The approach proposed returns 16 indeed

AlgoMonster is severely missing the test cases in general.

Line 6 for JS answer is incorrect. The nums array should be spread into Math.max since it takes numbers as input not an array.

where is the java solution for this problem?

Only @am is correct. Fixer used his own code and thought his solution is correct, but it isn’t.

Yeah, this is confusing. I think they meant to do ‘n < 3’ instead of ‘n < 2’.

I think THIS post here (https://leetcode.com/problems/house-robber/discuss/156523/From-good-to-great.-How-to-approach-most-of-DP-problems. ) should be the bases for DP problems approach (and implicitly how YOU should explain it). Currently your introductory chapter on this VERY important topic is ambiguous and… not here nor there (you make it sound like it’s a type of problem you could tackle only if you’re “talented / gifted” enough)

People paid for your service, so do your best to provide it as well as you can.

Hey, thanks for the message. I agree the DP section is a bit weak. We are in the process of reworking it. That being said, I’m not sure where we would have made you think ‘it’s a type of problem you could tackle only if you’re “talented / gifted” enough’. I think what we meant was DP is lower ROI as mentioned in the very beginning and is not worth spending too much time on (unless you are going for google which only has 2 coding interviews starting May 2022).

I may have misspoken on the “gifted” part. I think the fact that I am actually going for Google is why I am currently seeing a lot of DP problems (at least on leetcode) from them and AlgoMonster seems to not really treat this chapter as in depth as the others.

One other remark I have: the templates are really good and I have to commend you on those. On the other hand, there are some instances where in solving some problem the solution does not actually respect the corresponding template and somewhat complicates things more.

Also, I think I identified at least 3 coding styles in your solutions across multiple chapters: I have to say it’s a bit distracting and disruptive on the learning flow.

Thanks for looking into the feedback your receive!

Hi Dudu, that makes sense. Thanks for the feedback. The different coding style is definitely distracting and we should update them. Would you mind emailing us at support@algo.monster with some examples?

And stay tune on the new DP section. We are working on it

Needs more test cases. My simple solution of simply adding up the odds, then evens, and returning the max passed with flying colors. Leetcode test cases shut that down right away.

[1,3,1,3,100]

Hey there authors thanks for creating AlgoMonster. The BFS/DFS sections on graphs and tress are great. But the DP section does not live up to those standards. I am here for Google and DP really matters. Interview in 3 weeks any chance the DP update is coming soon?

Hey there authors thanks for creating AlgoMonster. The BFS/DFS sections on graphs and tress are great. But the DP section does not live up to those standards. I am here for Google and DP really matters. Interview in 3 weeks any chance the DP update is coming soon?