def METHOD_NAME(A: csr_matrix, B: csr_matrix, type="min") -> csr_matrix:
    """Return the element-wise minimum/maximum of sparse matrices `A` and `B`.
    Args:
        A: The first sparse matrix
        B: The second sparse matrix
        type: The type of calculation, either "min" or "max". Defaults to "min".
    Returns:
        A sparse matrix that contain the element-wise maximal or minimal of two sparse matrices.
    """
    AgtB = (A < B).astype(int) if type == "min" else (A > B).astype(int)
    M = AgtB.multiply(A - B) + B
    return M