from typing import Tuple


def _getGridSize(idx) -> Tuple[int, int]:
    """
    Return the number of spaces between the min and max of a collection of (int, int)
    tuples, inclusive.

    This essentially returns the number of grid locations along the i, and j dimesions,
    given the (i,j) indices of each occupied location. This is useful for determining
    certain grid offset behavior.
    """
    nx = max(key[0] for key in idx) - min(key[0] for key in idx) + 1
    ny = max(key[1] for key in idx) - min(key[1] for key in idx) + 1

    return nx, ny