Greedy

Greedy

Method Related Questions
Interval Scheduling problem - Min interval to remove
- Greedy, when two overlap, remove the one with later ends.
435. Non-overlapping Intervals

624. Maximum Distance in Arrays
280. Wiggle Sort
1605. Find Valid Matrix Given Row and Column Sums
179. Largest Number
1509. Minimum Difference Between Largest and Smallest Value in Three Moves

File confidence date difficulty note
624. Maximum Distance in Arrays 🔴 July 29, 2024 medium Keep a global min and max for the previous array values, compare with the new array's max and min to deduce the result range, and updated the global max/min
280. Wiggle Sort 🔴 July 29, 2024 medium Just make sure even index is smaller the prev, odd index greater than prev, else swap with prev
1605. Find Valid Matrix Given Row and Column Sums 🔴 November 05, 2024 medium For each position, maximise the value that you can get
45. Jump Game II 🟡 November 09, 2024 medium section the array up, for each section, calculated the furthest this section can reach, and assign next section to this
179. Largest Number 🔴 November 09, 2024 medium User python customer comparison function: cmp_to_key
1509. Minimum Difference Between Largest and Smallest Value in Three Moves 🔴 November 09, 2024 medium Sort, then do combinations for the smallest number and biggest numbers
134. Gas Station 🔴 November 09, 2024 medium -
121. Best Time to Buy and Sell Stock 🟡 November 11, 2024 - -
1526. Minimum Number of Increments on Subarrays to Form a Target Array 🟡 December 07, 2024 medium -
846. Hand of Straights 🔴 December 22, 2024 medium -
763. Partition Labels 🟡 December 22, 2024 medium -
678. Valid Parenthesis String 🔴 December 22, 2024 medium -
File confidence date difficulty note
871. Minimum Number of Refueling Stops 🟢 March 09, 2024 hard Travel until the fuel reached negative, then go back in time, take the fuel and station stored in stack
55. Jump Game 🟢 March 26, 2024 - -
334. Increasing Triplet Subsequence 🟢 April 27, 2024 medium If the two values are decreasing, it would reset the first value , and the second value will remain as inf
1899. Merge Triplets to Form Target Triplet 🟢 November 09, 2024 - remove triplets that has element higher than target