Solving LeetCode Problems Using Greedy Strategies

1648. Sell Diminishing-Valued Colored Balls The objective is to maximize profit when selling balls whose values decrease by 1 after each sale. The optimal approach is a greedy strategy where we always sell the currently most valuable balls available. By sorting the inventory in descending order, we can visualize the stock as columns. We process ...

Posted on Fri, 26 Jun 2026 16:49:48 +0000 by keystroke

Greedy Algorithm Applications: Common Problem Solutions

Longest Encreasing Subsequence The problem can be solved using a greedy approach by maintaining a sequence that represents the smallest possible tail value for all increasing subsequences of each length. The key insight is that for any increasing subsequence, if we encounter a number that's smaller than the current tail of our sequence, we can ...

Posted on Sat, 16 May 2026 11:27:09 +0000 by mrherman