#NEWLINE# def rob( self , nums ) : #NEWLINE# #INDENT# '\n        DP\n        O(n)\n        Let F_i be max value END AT or BEFORE i\n        F_i = max(F_{i-1}, F_{i-2} + A[i])\n\n        Notes:\n        If change the definition of F_i\n        Let F_i be mex value END AT i\n        F_i = max(F_{i-2-k}+A[i] for k \\in [0, i-2]),\n        Then time complexity is quadratic\n        ' #NEWLINE# n = len ( nums ) #NEWLINE# f = [ 0 for _ in xrange ( ( n + 2 ) ) ] #NEWLINE# for i in xrange ( 2 , ( i + 2 ) ) : #NEWLINE# #INDENT# f [ i ] = max ( f [ ( i - 1 ) ] , ( f [ ( i - 2 ) ] + nums [ ( i - 2 ) ] ) ) #NEWLINE# #UNINDENT# return f [ ( - 1 ) ]