Test case-3 is displaying wrong answer. Same code works fine on leetcode.
Smart robber . Issue with test case3
modify ur dp a bit.
dp[i] = max(house[i] + dp[i-2], dp[i-1] )
in ur base case
dp[0]=house[0]
dp[1]=max(house[0],house[1])
do let me know if anything is not clear
Hello @krishnaprateek824 you have raised your doubt again is there any issue you are facing?
another TA has already told you the solution.
please confirm here
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.