貪心 Greedy
50 題(20 題以此為主技法)
🎯 何時用
每步取局部最優即得全域最優;常見於排程、跳躍、加油站、配對。
🧩 模板心法
證明貪心選擇性質與最佳子結構;常先排序再線性掃描、或維護當前最佳/可達範圍。
Easy 2 題
Medium 40 題
- #53Maximum Subarray
- #55Jump Game
- #678Valid Parenthesis String
- #122Best Time to Buy And Sell Stock II
- #134Gas Station
- #179Largest Number
- #280Wiggle Sort
- #646Maximum Length of Pair Chain
- #649Dota2 Senate
- #665Non Decreasing Array
- #846Hand of Straights
- #918Maximum Sum Circular Subarray
- #978Longest Turbulent Subarray
- #1029Two City Scheduling
- #1647Minimum Deletions to Make Character Frequencies Unique
- #1899Merge Triplets to Form Target Triplet
- #1921Eliminate Maximum Number of Monsters
- #2405Optimal Partition of String
- #11Container With Most Water
- #435Non-overlapping Intervals
- #316Remove Duplicate Letters
- #621Task Scheduler
- #45Jump Game II
- #402Remove K Digits
- #763Partition Labels
- #767Reorganize String
- #881Boats to Save People
- #1405Longest Happy String
- #1423Maximum Points You Can Obtain From Cards
- #1838Frequency of The Most Frequent Element
- #1871Jump Game VII
- #1888Minimum Number of Flips to Make The Binary String Alternating
- #1911Maximum Alternating Subsequence Sum
- #1963Minimum Number of Swaps to Make The String Balanced
- #1968Array With Elements Not Equal to Average of Neighbors
- #2439Minimize Maximum of Array
- #2477Minimum Fuel Cost to Report to the Capital
- #2483Minimum Penalty for a Shop
- #2542Maximum Subsequence Score
- #2616Minimize the Maximum Difference of Pairs