Groups
Double counting is the strategy of counting the same quantity in two different ways to derive an equality or an efficient algorithm.
Mo's algorithm answers many range queries offline by reordering them to minimize pointer movement along the array.