Intermediate Greedy Problems for Coding Interviews
40 intermediate Greedy problems from real coding interviews, each with test cases you can run online. By difficulty they split into 0 basic, 40 intermediate and 0 advanced. The companies that ask them most often are Amazon, Google, Bloomberg, Meta.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Merge Intervals (Intermediate)
- Insert an Interval (Intermediate)
- Course Schedule Feasible (Intermediate)
- Weighted Job Scheduling (Intermediate)
- Minimum Number of Buses (Intermediate)
- Find Right Interval (Intermediate)
- Common Free Time (Intermediate)
- Minimum Number of Perfect Squares (Intermediate)
- Token Bucket Scheduler (Intermediate)
- Course Schedule Order (Intermediate)
- Task Scheduler (Intermediate)
- Two City Scheduling (Intermediate)
- Interval List Intersections (Intermediate)
- My Calendar I (Intermediate)
- Assembly Line Scheduling (Intermediate)
- Remove Covered Intervals (Intermediate)
- Task Scheduler II (Intermediate)
- Minimum Characters to Append for Palindrome (Intermediate)
- Minimum Increments on Subarrays to Form Target (Intermediate)
- Minimum Removals for Strictly Increasing Array (Intermediate)
- Minimum Towers of Cubes (Intermediate)
- Maximum Reward Scheduling Tasks (Intermediate)
- Coin Redistribution Moves on Tree (Intermediate)
- Operations to Equalize Array by Adding K (Intermediate)
- Minimum Swaps to Fix Index Parity (Intermediate)
- Egyptian Fraction Greedy Term Count (Intermediate)
- Intervals Covering Point Queries (Intermediate)
- Adjacent Swaps to Sort Letters (Intermediate)
- Rotations to Sort Ascending (Intermediate)
- Edges Needed to Connect Graph (Intermediate)
- Total Union Length of Intervals (Intermediate)
- Deepest Interval Overlap (Intermediate)
- Idle Time Between Intervals (Intermediate)
- Intersecting Interval Pairs (Intermediate)
- Smallest Uncovered Time Step (Intermediate)
- Time Covered Exactly Twice (Intermediate)
- Covered Time Inside a Window (Intermediate)
- Shared Free Time Total (Intermediate)
- Deletions to Make Anagrams (Intermediate)
- Minimum Rest Stops (Intermediate)
Related
Frequently asked questions
How do I get good at greedy problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run greedy problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.