Microsoft Interview Problem
Anonymous User
2831

Given an array A of size N. Find the maximum subset-sum of elements that you can make from the given array such that for every two consecutive elements in the array, at least one of the elements is present in our subset.
Input: N = 4, A[] = {1,-1,3,4}
Output: 8
Explanation: We can choose 1st, 3rd and 4th index, you can check that this is maximum possible sum.

  • Can aynone please :) solve this problem using recursion + memoization?
Comments (12)