You have now seen several optimization problems with a common pattern:
Identify the constraint:: What limits your choices? (capital, cooldown, position)
Find the greedy criterion:: Among valid choices, which is best? (max profit, max frequency, correct partner)
Process in order:: Often sort by one criterion, then greedily select by another
Use data structures:: Heaps help you efficiently find the best choice among valid options When you see "minimize cost" or "maximize value" with constraints, think about what greedy criterion might work.