Greedy-algorithm

Level: Advanced

1. IPO Problem: Given a list of projects with capital and profits, find the maximum profit by selecting projects to invest in, given a limit on the number of projects.
2. Design an LFU Cache: Implement a Least Frequently Used (LFU) cache with get and put operations.
3. Minimum Cost to Connect Ropes: Given lengths of ropes, find the minimum cost to connect all ropes into one rope using a priority queue.
4. Maximize Sum of Non-overlapping Intervals: Given a list of intervals, find the maximum sum of non-overlapping intervals.
5. Maximize Profit with Unlimited Transactions: Given stock prices, find the maximum profit with unlimited buy-sell transactions.
6. Maximize Sum of Two Non-overlapping Subarrays: Given an array, find the maximum sum of two non-overlapping subarrays.
7. Minimum Cost to Connect All Points: Given points on a plane, find the minimum cost to connect all points.
8. Maximize Profit with Limited Transactions: Given stock prices, find the maximum profit with at most two transactions.
9. 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.
10. Minimize Cost to Reach Destination: Given a list of cities with costs to travel between them, find the minimum cost to travel from city A to city B.
11. Maximize Sum After K Negations: Given an array and an integer K, maximize the sum of the array after flipping the sign of at most K elements using a priority queue.
12. Maximize Profit in Job Scheduling: Given a list of jobs with deadlines and profits, find the maximum profit schedule using a priority queue.
13. Maximize the Number of Non-overlapping Intervals: Given a list of intervals, find the maximum number of non-overlapping intervals using a priority queue.
14. Maximize the Confusion of an Exam: Given a string of answers, maximize the number of consecutive answers without more than k changes using a priority queue.
15. Maximize Toys Within Budget: Given an array of toy prices and a budget, find the maximum number of toys that can be bought using a priority queue.
16. Maximize the Number of Non-overlapping Intervals with a Constraint: Given intervals, find the maximum number of non-overlapping intervals with a constraint using a priority queue.
17. Maximize Profit with Stock Prices: Given stock prices, find the maximum profit with unlimited transactions using a priority queue.
18. Maximize Number of Non-overlapping Intervals: Given a list of intervals, find the maximum number of non-overlapping intervals using a priority queue.
19. Maximize Sum After K Operations: Given an array and an integer K, maximize the sum of the array after performing at most K operations using a priority queue.
20. Maximize Sum of Array Elements: Given an array and a number K, maximize the sum of the array after performing at most K operations using a priority queue.
21. Maximize Profit with Limited Transactions: Given stock prices, find the maximum profit with at most k transactions using a priority queue.
22. 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 using a priority queue.
23. 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 using a priority queue.
24. 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 using a priority queue.
25. Maximize Sum of Non-overlapping Intervals: Given a list of intervals, find the maximum sum of non-overlapping intervals using a priority queue.
26. Maximize Profit with Unlimited Transactions: Given stock prices, find the maximum profit with unlimited buy-sell transactions using a priority queue.
27. Maximize Sum of Two Non-overlapping Subarrays: Given an array, find the maximum sum of two non-overlapping subarrays using a priority queue.
28. Minimum Cost to Connect All Points: Given points on a plane, find the minimum cost to connect all points using a priority queue.
29. Maximize Sum After K Negations: Given an array and an integer K, maximize the sum of the array after flipping the sign of at most K elements using a priority queue.
30. Maximize Profit in Job Scheduling: Given a list of jobs with deadlines and profits, find the maximum profit schedule using a priority queue.

Beginner Level: View

Advanced Level: View