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
Solution57.5%Medium
Counting, Greedy +4· 20 companies
Solution54.7%Hard
Array, Greedy +3· 5 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
Solution63.5%Hard
Array, Greedy +2· 3 companies
860. Lemonade ChangeVideo
Solution59.6%Easy
Array, Greedy· 8 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
Solution62.2%Hard
Greedy, Queue +2· 1 company
942. DI String MatchVideo
Solution81.0%Easy
Array, Greedy +2· 3 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
Solution62.1%Easy
Array, Greedy +2· 5 companies
Solution45.6%Medium
Greedy, String· 3 companies
Solution56.6%Medium
Greedy, Math· 5 companies
Solution54.3%Easy
Array, Greedy +1· 4 companies
Solution56.5%Medium
Array, Greedy· 4 companies
1024. Video StitchingVideo
Solution53.2%Medium
Array, Dynamic Programming +1· 3 companies
Solution69.0%Medium
Array, Greedy +1· 5 companies
Solution49.5%Medium
Array, Greedy· 2 companies
1054. Distant BarcodesVideo
Solution49.3%Medium
Array, Counting +4· 2 companies
1055. Shortest Way to Form StringVideoPremium
Solution61.6%Medium
Binary Search, Greedy +2· 3 companies
1057. Campus BikesVideoPremium
Solution58.8%Medium
Array, Greedy +1· 3 companies
Solution45.9%Medium
Array, Greedy +3· 1 company
Solution64.7%Medium
Array, Counting +3· 1 company
Solution71.8%Medium
Array, Greedy +1· 5 companies
1183. Maximum Number of OnesVideoPremium
Solution70.6%Hard
Solution67.0%Easy
Array, Greedy +1· 1 company
Solution49.2%Hard
Array, Greedy +2· 1 company
Solution87.3%Easy
Counting, Greedy +1· 4 companies
Solution65.3%Medium
Greedy, Math +1· 4 companies
Solution49.4%Medium
Array, Greedy +1· 1 company
Showing 51–100 of 485

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.