Talentd
FleetCode
Make and follow sheets.Sign in

Greedy Problems (485)

Problems tagged with Greedy. Start with the easy ones, then move to medium and hard.

51 Easy330 Medium104 Hard

Learn these first

1
Array

Many greedy problems operate on arrays where elements must be processed sequentially or reordered. Understanding array traversal, indexing, and in-place updates helps implement greedy decisions efficiently.

2
Graph

Several graph algorithms like Prim's and certain shortest path techniques rely on greedy choices. Understanding graph structures helps apply greedy strategies to network and path optimization problems.

3
Sorting

A large portion of greedy solutions begin by sorting elements (such as intervals or tasks). Learning sorting-based strategies helps identify optimal ordering for greedy selection.

4
Dynamic Programming

Studying dynamic programming helps you understand when greedy works and when it fails. Many problems can be solved by both approaches, making this comparison valuable for interviews.

5
Heap (Priority Queue)

Priority queues allow you to repeatedly choose the best candidate at each step, which is a common greedy technique in scheduling, merging, and resource allocation problems.

TitleSolutionAcceptDifficultyTopics
Solution60.9%Medium
Array, Greedy +1· 57 companies
45. Jump Game IIVideo
Solution43.2%Medium
Array, Dynamic Programming +1· 26 companies
55. Jump GameVideo
Solution41.2%Medium
Array, Dynamic Programming +1· 33 companies
134. Gas StationVideo
Solution48.4%Medium
Array, Greedy· 29 companies
179. Largest NumberVideo
Solution43.9%Medium
Array, Greedy +2· 23 companies
253. Meeting Rooms IIVideoPremium
Solution52.6%Medium
Array, Greedy +4· 42 companies
280. Wiggle SortVideoPremium
Solution68.5%Medium
Array, Greedy +1· 4 companies
Solution54.7%Medium
Greedy, Monotonic Stack +2· 13 companies
324. Wiggle Sort IIVideo
Solution38.4%Medium
Array, Divide and Conquer +3· 4 companies
Solution39.3%Medium
Array, Greedy· 7 companies
Solution49.9%Medium
Array, Dynamic Programming +1· 1 company
402. Remove K DigitsVideo
Solution37.7%Medium
Greedy, Monotonic Stack +2· 21 companies
Solution57.5%Medium
Array, Dynamic Programming +2· 18 companies
484. Find PermutationVideoPremium
Solution67.0%Medium
Array, Greedy +2· 1 company
Solution43.4%Medium
Array, Greedy +1· 1 company
Solution38.7%Medium
Array, Greedy +4· 9 companies
Solution57.4%Medium
Array, Binary Search +3· 9 companies
621. Task SchedulerVideo
Solution64.0%Medium
Array, Counting +4· 24 companies
Solution45.7%Medium
Array, Greedy· 5 companies
625. Minimum FactorizationVideoPremium
Solution34.2%Medium
Greedy, Math· 1 company
Solution62.2%Medium
Array, Dynamic Programming +2· 2 companies
649. Dota2 SenateVideo
Solution50.3%Medium
Greedy, Queue +1· 6 companies
Solution52.7%Medium
Array, Greedy +2· 2 companies
670. Maximum SwapVideo
Solution51.6%Medium
Greedy, Math· 9 companies
Solution42.8%Medium
Dynamic Programming, Greedy +2· 15 companies
Solution50.1%Medium
Greedy, Math· 3 companies
Solution81.8%Medium
Greedy, Hash Table +2· 9 companies
Solution57.5%Medium
Counting, Greedy +4· 20 companies
Solution64.1%Medium
Array, Greedy +3· 7 companies
Solution58.0%Medium
Array, Greedy +2· 8 companies
Solution86.2%Medium
Array, Greedy +1· 3 companies
Solution56.4%Medium
Array, Binary Search +3· 5 companies
Solution58.5%Medium
Array, Greedy +2· 6 companies
Solution80.3%Medium
Array, Bit Manipulation +2· 3 companies
Solution55.0%Medium
Array, Greedy +2· 3 companies
Solution62.7%Medium
Array, Greedy +2· 11 companies
Solution38.4%Medium
Array, Greedy +2· 3 companies
Solution74.7%Medium
Greedy, Stack +1· 7 companies
Solution60.7%Medium
Array, Counting +2· 7 companies
948. Bag of TokensVideo
Solution59.5%Medium
Array, Greedy +2· 4 companies
Solution39.7%Medium
Array, Greedy +2· 1 company
Solution49.7%Medium
Array, Greedy +1· 3 companies
969. Pancake SortingVideo
Solution71.7%Medium
Array, Greedy +2· 3 companies
Solution45.6%Medium
Greedy, String· 3 companies
Solution56.6%Medium
Greedy, Math· 5 companies
Solution56.5%Medium
Array, Greedy· 4 companies
Showing 1–50 of 327

More about Greedy

Greedy algorithms are a powerful problem-solving technique in data structures and algorithms where you make the locally optimal choice at each step, hoping it leads to a globally optimal solution. Instead of exploring every possibility like Backtracking or storing intermediate states like Dynamic Programming, greedy solutions focus on taking the best immediate decision based on the current state.

This strategy appears frequently in coding interviews because it tests your ability to recognize patterns and prove correctness. Many classic interview problems—such as activity selection, interval scheduling, and minimum cost connections—can be solved efficiently using greedy decisions combined with sorting or priority queues. In fact, greedy algorithms often pair naturally with Sorting, Array processing, and data structures like a Heap (Priority Queue).

Common greedy patterns include:

  • Selecting the earliest finishing or smallest element first
  • Always choosing the option with the best immediate gain
  • Sorting elements and processing them in a specific order
  • Using priority queues to repeatedly extract the optimal choice

Greedy techniques are widely used in optimization and graph problems. For example, algorithms like minimum spanning tree or shortest path often rely on greedy decisions, making them closely related to concepts in Graph algorithms.

The key challenge with greedy problems is recognizing when the greedy-choice property holds—meaning a sequence of local optimal decisions leads to the overall best solution. Practicing a large variety of problems is the fastest way to build that intuition. On FleetCode, you can strengthen this skill by solving , each designed to help you identify patterns, analyze complexity, and confidently apply greedy strategies in technical interviews.

Greedy: common questions

What are Greedy algorithms in DSA?

Greedy algorithms make the best immediate choice at each step with the goal of reaching a globally optimal solution. They work when a problem has the greedy-choice property and optimal substructure. Classic examples include activity selection, Huffman coding, and certain shortest path algorithms.

What are common Greedy patterns in DSA?

Common patterns include sorting intervals before selecting them, always picking the smallest or largest available option, using priority queues to choose the next best element, and making decisions based on earliest finish time or minimum cost.

Is Greedy important for FAANG interviews?

Yes. Greedy algorithms appear regularly in FAANG and top tech interviews because they test optimization thinking and pattern recognition. While less frequent than arrays or graphs, mastering greedy problems can give you an edge in medium and hard interview questions.

What is the best way to learn Greedy algorithms?

Start by understanding the greedy-choice property and solving classic problems like activity selection and coin change. Then practice pattern-based questions involving sorting, heaps, and intervals. Reviewing proofs of correctness also helps build intuition for when greedy works.

What are the best Greedy problems for coding interviews?

Popular greedy interview problems include interval scheduling, jump game, gas station, task scheduling, and minimum number of arrows to burst balloons.

When should you use a Greedy approach instead of Dynamic Programming?

Use a greedy approach when a locally optimal decision always leads to the globally optimal solution. If a problem requires exploring multiple states or overlapping subproblems, dynamic programming is usually a better choice.