def rob(arr, index):
    if index >= len(arr):
        return 0
    dp = [0 for i in range(0, len(arr))]

    for i in range(0, len(dp)):
        if dp[i] == 0:
            dp[i] = max(arr[index] + rob(arr, index+2), 0 + rob(arr, index+1))

    return dp[index]



arr = [2, 1, 1, 2]
maxele = rob(arr, 0)
print(maxele)
ca3f256ad1c5db1d88bff5254ec3d335804e88e9
<mask token>

def rob(arr, index):
    if index >= len(arr):
        return 0
    dp = [(0) for i in range(0, len(arr))]
    for i in range(0, len(dp)):
        if dp[i] == 0:
            dp[i] = max(arr[index] + rob(arr, index + 2), 0 + rob(arr, 
                index + 1))
    return dp[index]


<mask token>

def rob(arr, index):
    if index >= len(arr):
        return 0
    dp = [(0) for i in range(0, len(arr))]
    for i in range(0, len(dp)):
        if dp[i] == 0:
            dp[i] = max(arr[index] + rob(arr, index + 2), 0 + rob(arr, 
                index + 1))
    return dp[index]


<mask token>
print(maxele)

def rob(arr, index):
    if index >= len(arr):
        return 0
    dp = [(0) for i in range(0, len(arr))]
    for i in range(0, len(dp)):
        if dp[i] == 0:
            dp[i] = max(arr[index] + rob(arr, index + 2), 0 + rob(arr, 
                index + 1))
    return dp[index]


arr = [2, 1, 1, 2]
maxele = rob(arr, 0)
print(maxele)

def rob(arr, index):
    if index >= len(arr):
        return 0
    dp = [0 for i in range(0, len(arr))]

    for i in range(0, len(dp)):
        if dp[i] == 0:
            dp[i] = max(arr[index] + rob(arr, index+2), 0 + rob(arr, index+1))

    return dp[index]



arr = [2, 1, 1, 2]
maxele = rob(arr, 0)
print(maxele)