Skip to main content

1.4 Exercises

Basic Difficulty​

605. Can Place Flowers​

What kind of greedy strategy can be used to plant the maximum number of flowers?


452. Minimum Number of Arrows to Burst Balloons​

This problem is very similar to problem 435, but what is the subtle difference?


763. Partition Labels​

To satisfy your greedy strategy, do you need some preprocessing?

warning

Counting information (such as frequency, count, first appearance position, last appearance position, etc.) before processing the array can significantly reduce the difficulty of the problem.


122. Best Time to Buy and Sell Stock II​

Among stock trading problems, this is a relatively simple one. Without restricting the number of transactions, how can you achieve the maximum profit?


Advanced Difficulty​

406. Queue Reconstruction by Height​

Friendly reminder, this problem may require both sorting and insertion operations.


665. Non-decreasing Array​

Carefully consider whether your greedy strategy remains optimal in all scenarios.