<jupyter_start><jupyter_text>Max Array Sum![image](https://user-images.githubusercontent.com/50367487/83503109-90b9d380-a4fd-11ea-9557-6fcd35752cab.png)<jupyter_code>#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the maxSubsetSum function below.
def maxSubsetSum(arr):
    if n == 1:
        return arr[0]

    dp = [arr[0], max(arr[0], arr[1])] + [0] * (n - 2)

    for i in range(2, n):
        dp[i] = max(arr[i], dp[i - 1], dp[i - 2] + arr[i])

    return dp[-1]

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    n = int(input())

    arr = list(map(int, input().rstrip().split()))

    res = maxSubsetSum(arr)

    fptr.write(str(res) + '\n')

    fptr.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1806282722513089, 'fraction_numerical': 0.061518324607329845, 'mean_word_length': 3.473684210526316, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '528591', 'license': 'MIT', 'n_tokens_mistral': 343, 'n_tokens_neox': 310, 'n_words': 62, 'path': 'Interview Preparation Kit/8. Dynamic Programming(1)/Max Array Sum.ipynb', 'repo_name': 'Nam-SH/HackerRank', 'size': '764'}