Maximum Candies Tags: Dynamic Programming, Recursion with memoization. PROBLEM LINK : Author: Shami. It may be tempting to solve this problem with greedy strategy but, as the example shows, it gives the wrong answer. To reach (i, j), there are two options (i1, j) or (i, j1) (for legal values of i and j). Let’s just iterate through both of them and take the maximum. Just don’t forget to cache the values, or it will become an exponential time algorithm! Top Down (Recursion with memoization) Bottom up (DP) asked 12 Jan, 14:09
