<qiyuangong>213_House_Robber_II_1.py
def rob( nums):
    if nums is None or len(nums) == 0:
        return 0
    ls = len(nums)
    dp = [0] * ls
    
    dp[0] = nums[0]
    for i in range(1, ls - 1):
        if i < 2:
            dp[i] = max(nums[i], dp[i - 1])
        else:
            dp[i] = max(dp[i - 2] + nums[i], dp[i - 1])
    res = dp[ls - 2]
    
    dp[0] = 0
    for i in range(1, ls):
        if i < 2:
            dp[i] = max(nums[i], dp[i - 1])
        else:
            dp[i] = max(dp[i - 2] + nums[i], dp[i - 1])
    return max(res, dp[ls - 1])
def sample_funcname ( var_0 ) :
    if var_0 is None or len ( var_0 ) == 0 :
        return 0
    var_4 = len ( var_0 )
    var_5 = [ 0 ] * var_4
    var_5 [ 0 ] = var_0 [ 0 ]
    for var_8 in range ( 1 , var_4 - 1 ) :
        if var_8 < 2 :
            var_5 [ var_8 ] = max ( var_0 [ var_8 ] , var_5 [ var_8 - 1 ] )
        else :
            var_5 [ var_8 ] = max ( var_5 [ var_8 - 2 ] + var_0 [ var_8 ] , var_5 [ var_8 - 1 ] )
    var_11 = var_5 [ var_4 - 2 ]
    var_5 [ 0 ] = 0
    for var_8 in range ( 1 , var_4 ) :
        if var_8 < 2 :
            var_5 [ var_8 ] = max ( var_0 [ var_8 ] , var_5 [ var_8 - 1 ] )
        else :
            var_5 [ var_8 ] = max ( var_5 [ var_8 - 2 ] + var_0 [ var_8 ] , var_5 [ var_8 - 1 ] )
    return max ( var_11 , var_5 [ var_4 - 1 ] )
