Sorting, two pointers, prefix sums, and classic problems.
Custom sort logic, multi-key, intuition behind compare(a,b).
O(N²) → O(N log N).
Greedy removal strategy.