Greedy-algorithm

Level: Intermediate

1. Car Pooling: Given trips with passengers and their start and end points, determine if it is possible to pick up and drop off passengers without exceeding the car's capacity.
2. Minimum Number of Refueling Stops: Given a start gas station, a target station, and gas stations with their distances and fuel, find the minimum number of refueling stops required to reach the target.
3. Maximize Sum After K Negations: Given an array and a number K, maximize the sum of the array after flipping the sign of at most K elements.
4. Reorganize String: Given a string, reorganize it so that no two adjacent characters are the same.
5. Job Scheduling with Profit: Given jobs with deadlines and profits, find the maximum profit sequence of jobs that can be done within their deadlines.
6. Maximize Profit in Job Scheduling: Given a list of jobs with deadlines and profits, find the maximum profit schedule.
7. Split Array into Consecutive Subsequences: Given an array, split it into consecutive subsequences.
8. Minimum Window Subsequence: Given two strings, find the minimum window in S which contains all the characters in T.
9. Greedy Activity Selection Problem: Select the maximum number of non-overlapping activities.
10. Maximum Subarray Sum with One Deletion: Find the maximum subarray sum with at most one deletion.
11. Minimum Number of Taps to Open to Water a Garden: Given an integer n and an array of taps with their range, find the minimum number of taps needed to water the entire garden.
12. Minimum Cost to Connect Ropes: Given lengths of ropes, find the minimum cost to connect all ropes into one rope.
13. Maximize the Confusion of an Exam: Given a string of answers, maximize the number of consecutive answers without more than k changes.
14. Minimum Cost to Make at Least One Valid Cut: Given an array, find the minimum cost to make a valid cut.
15. Maximize Toys Within Budget: Given an array of toy prices and a budget, find the maximum number of toys that can be bought.
16. Maximum Profit with K Transactions: Given stock prices, find the maximum profit with at most K transactions.
17. Maximum Number of Non-overlapping Intervals: Given a list of intervals, find the maximum number of non-overlapping intervals.
18. Maximize Sum After K Operations: Given an array and an integer K, maximize the sum of the array after performing at most K operations.
19. Minimum Number of Flips to Make the Binary String Alternating: Given a binary string, find the minimum number of flips required to make the string alternating.
20. Maximize the Number of Balls in a Box: Given a list of balls with their weights, find the maximum number of balls in a box.
21. Maximize Profit with Stock Prices: Given stock prices, find the maximum profit with unlimited transactions.
22. Maximize Number of Non-overlapping Intervals with a Constraint: Given intervals, find the maximum number of non-overlapping intervals with a constraint.
23. Calculate Maximum Profit with Limited Transactions: Given stock prices, find the maximum profit with at most K transactions.
24. Minimum Number of Moves to Equal Array Elements: Given an array, find the minimum number of moves to make all elements equal.
25. Maximize Sum of Array Elements: Given an array and a number K, maximize the sum of the array after performing at most K operations.
26. Make Array Non-decreasing with Minimal Changes: Given an array, find the minimal number of changes needed to make it non-decreasing.
27. Maximize Profit in Stock Trading: Given stock prices, find the maximum profit achievable by performing at most one buy-sell transaction.
28. Maximize the Number of Balls in a Box with Constraints: Given an array of balls with their weights, find the maximum number of balls in a box with constraints.
29. Maximize the Number of Non-overlapping Intervals with Minimal Cost: Given intervals with costs, find the maximum number of non-overlapping intervals with minimal cost.
30. Partition Array into Disjoint Intervals: Given an array, partition it into disjoint intervals where the maximum element of the left interval is less than or equal to the minimum element of the right interval.

Beginner Level: View

Advanced Level: View