Problem List for Greedy https://leetcode.com/list/50f6p33i

Greedy algorithm is nothing but a paradigm that builds problems piece by piece. In recursion, we keep on dividing a big problem into multiple smaller chunks and solving those subproblems which are finally used to solve our actual problem. But this isn't the case for Greedy. In this, at any instant, we choose a piece of the solution that will offer the most obvious and immediate benefit. For example the famous problem Fractional Knapsack. We keep on choosing the items which are local maxima that are, the items that have a maximum value of "profit per unit weight" and in the end get the global maximum.

Some popular Greedy Algorithms

When to use it?

Whenever we see optimum or maximum or minimum or larget or smallest, the first approach which should strike our mind should be Greedy or Dynamic Programming. If the problem is solvable via recursion, one should do for memoized recursion or DP else start with the brute force and reduce it to Greedy.

Some problems based on Greedy for beginners with the intuition behind solving them: