Pattern
Greedy
Use a greedy method when the best local choice at each step never hurts the final answer. The hard part is the proof: show that swapping in another choice cannot do better. When it holds, the cost is usually a sort plus one pass.
1. Maximum Subarrayarray · greedy · kadaneMed.2. Jump Gamearray · greedy · reachabilityMed.3. Jump Game IIarray · greedy · jump windowsMed.4. Gas Stationarray · greedy · circularMed.5. Hand of Straightsarray · greedy · sorting · hash mapMed.6. Merge Triplets to Form Target Tripletarray · greedy · filteringMed.7. Partition Labelsstring · greedy · two pointersMed.8. Valid Parenthesis Stringstring · greedy · bracketsMed.