def compute_lempel_ziv(binary_sequence):
    """
    Computes the Lempel-Ziv complexity of a binary string.

    Parameters
    ----------
    binary_sequence : array-like[int]
        The input binary string.

    Returns
    -------
    int
        The Lempel-Ziv complexity of the string.

    Notes
    ------
    Source: https://naereen.github.io/Lempel-Ziv_Complexity/
    """
    u, v, w = 0, 1, 1
    v_max = 1
    length = len(binary_sequence)
    complexity = 1
    while True:
        if binary_sequence[u + v - 1] == binary_sequence[w + v - 1]:
            v += 1
            if w + v >= length:
                complexity += 1
                break
        else:
            if v > v_max:
                v_max = v
            u += 1
            if u == w:
                complexity += 1
                w += v_max
                if w > length:
                    break
                else:
                    u = 0
                    v = 1
                    v_max = 1
            else:
                v = 1
    return complexity