×

# MAXCANDY - Editorial

 0 Maximum Candies Tags: Dynamic Programming, Recursion with memoization. PROBLEM LINK : practice Author: Shami. Tester: Kaustav 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 (i-1, j) or (i, j-1) (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 0★mmmreddy 12●1 accept rate: 0%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×126
×1