def partition(arr: list, low: int, high: int) -> int:
    """Partition the array

    Args:
        arr (list): the array to partition
        low (int): the left-most index
        high (int): the right-most index

    Returns:
        int: the new pivot location
    """
    i = low - 1
    pivot = arr[high]

    # Swap the numbers of the right-most and left-most index
    for j in range(low, high):
        if arr[j] <= pivot:
            i += 1
            arr[i], arr[j] = arr[j], arr[i]
    
    # Swap the right-most number with the pivot
    arr[i+1], arr[high] = arr[high], arr[i+1]

    return i + 1