Incorrect Test Case 3

My Code is working completely fine on leetcode. But only one test case is failing on hackerblock. Please Check the test case or if there is any mistake in my code please let me know.

Hey @yash.saini275
modify your dp by doing

arr[i] = max(nums[i] + arr[i-2], arr[i-1] ) by runing for loop from 2
in ur robbed case,
make it

 if (nums.size() < 2 && nums.size()>= 0)
    {
        robbed= nums[nums.size() - 1];
        return ans;
    }

If this doesn’t solve it do let me know

Well it works but then all other test cases fails.

Send me the link of hackerblocks for this question

I couldn’t find the hackerblock link

https://hack.codingblocks.com/app/contests/1783/1336/problem

I guess there’s an issue with this test case, i would see and let you know if there’s any update on this or not, in case you want rapid solution i would suggest you to open the test case or ask a new doubt so that another TA can help you by solving it. Though i think that the logic you have applied in your recent code is right.

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.