Share my 0ms C++ code

  • 0
        class Solution {
    	int robIter(vector<int>& money, int c, int dp1, int dp2) {
    		if (c >= money.size()) return dp2;
    		else return robIter(money, c, dp2, max(dp1 + money[c++], dp2));
    	int rob(vector<int>& nums) {
    		return robIter(nums, 0, 0, 0);

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.