The `crossover` function takes as input a 2D NumPy array parents and an integer n_pop. The function performs a genetic crossover operation on parents to generate n_pop offspring. Use vectorized implementation if possible. ### Solution Function Signature ```python def crossover(parents: np.ndarray, n_pop: int) -> np.ndarray: ```