Basic Greedy Problems for Coding Interviews
14 basic Greedy problems from real coding interviews, each with test cases you can run online. By difficulty they split into 14 basic, 0 intermediate and 0 advanced. The companies that ask them most often are Amazon, Apple, Bloomberg, Google.
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
- Calendar With Double Booking (Basic)
- Meeting Rooms (Basic)
- Minimum Suffix Increments to Make Array Non-Decreasing (Basic)
- Single-Element Increments to Sort Array (Basic)
- Count Palindromic Times in Interval (Basic)
- Minimum Changes to Make Palindrome (Basic)
- Minimum Increments for Strictly Increasing Array (Basic)
- Palindrome Array Cost (Basic)
- Heartbeat Missed Alerts (Basic)
- Greedy Coin Count US (Basic)
- Merged Interval Count (Basic)
- Back to Back Interval Count (Basic)
- Changes to Alternate Letter Case (Basic)
- Minimum Hops of Bounded Size (Basic)
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.