Loop to choose the elements of the array to delete from the array
for i in range ( 2 , len ( dp ) ) : NEW_LINE INDENT dp [ i ] = max ( dp [ i - 1 ] , dp [ i - 2 ] + freq [ i ] * i ) NEW_LINE DEDENT return dp [ - 1 ] NEW_LINE