Merge Sorted Sources
Merge Sorted Sources When To Use Use this when consuming two sorted arrays, lists, or interval streams.
Merge Sorted Sources When To Use Use this when consuming two sorted arrays, lists, or interval streams.
Opposite Ends When To Use Use this when two pointers start at opposite ends and each move has a local reason to discard one side.
Partition Around Pivot When To Use Use this when separating values into groups in-place.
Same Direction Read Write When To Use Use this when compacting, filtering, overwriting, or partitioning in-place.
Specials When To Use Use this for two-pointer problems that have a problem-specific invariant and do not fit a broad reusable template cleanly.
Base change related problems make for good puzzles.
I’ve always wanted to be able to make music, something at least, and now with LLMs venturing into such unknown territories has become so easy.
The core idea of the whole process is intuitive to me so I’ll just leave some implemeational comments on stuff and doubts while writing.
pre-requisites the idea of such decomposition algorithms on trees is that any “breaking” you do, for a reference pair of nodes (u,v) they will be in ONE component until some specific node c, splits them into different ones.
Think of this when you can answer something for a node you and want to answer the same for every node.