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.
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.
Problem Statement: In an array of 0s and 1s, we are to fing length of the longest chain of 1s.
Problem Statement: Given array of prices, you can buy stock and sell it on a later date only once. Goal is to maximize profit.
Problem Statement: Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index.
Problem Statement: Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimum number of jumps. You can assume that you can always reach the last index.