class Solution(object):
    def rob(self, nums):
        """
        :type nums: List[int]
        :rtype: int

        Note:
        Dynamic Programming
        
        dp[i]=max(dp[i-2]+num[i],dp[i-1])
        dp[0]=nums[0]
        dp[1]=max(nums[0],nums[1])

    	Shorter Approach:
        a=0
        b=0
        for num in nums:
            m=a
            n=b
            a=n+num
            b=max(m,n)
        return max(a,b)
        """
        l = len(nums)
        if l == 0:
            return 0
        elif l == 1:
            return nums[0]
        elif l == 2:
            return max(nums)

        dp=[0] * l
        for i in range(l):
            if i == 0:
                dp[0] = nums[0]
            elif i == 1:
                dp[1] = max(nums[0], nums[1])
            else:
                dp[i] = max(dp[i - 2] + nums[i], dp[i - 1])
        return dp[-1]

@@ -1,337 +1,570 @@
-class Solution(object):%0A    def rob(self, nums):%0A        %22%22%22%0A        :type nums: List%5Bint%5D%0A        :rtype: int%0A%0A        Note:%0A        Dynamic Programming%0A        %0A        dp%5Bi%5D=max(dp%5Bi-2%5D+num%5Bi%5D,dp%5Bi-1%5D)%0A        dp%5B0%5D=nums%5B0%5D%0A        dp%5B1%5D=max(nums%5B0%5D,nums%5B1%5D)%0A%0A    %09Shorter Approach:%0A        a=0%0A        b=0%0A        for num in
+%22%22%22%0AYou are a professional robber planning to rob houses along a street. Each house%0Ahas a certain amount of money stashed, the only constraint stopping you from%0Arobbing each of them is that adjacent houses have security system connected and%0Ait will automatically contact the police if two adjacent houses were broken%0Ainto on the same night.%0A%0AGiven a list of non-negative integers representing the amount of money of each%0Ahouse, determine the maximum amount of money you can rob tonight without%0Aalerting the police.%0A%22%22%22%0Aclass Solution(object):%0A    def rob(self,
  nums
+)
 :%0A  
@@ -573,98 +573,61 @@
     
-    m=a%0A            n=b%0A            a=n+num%0A            b=max(m,n)%0A        return max(a,b)
+%22%22%22%0A        :type nums: List%5Bint%5D%0A        :rtype: int
 %0A   

update 198