import typing


def selective_join(parts: typing.List[str], n: int) -> typing.List[str]:
    """
    Given the list of N+1 strings, and an integer n in [0, 2**N - 1] range,
    concatenate i-th and (i+1)-th string with space inbetween if bit i is not set in n.
    Examples:
         selective_join(['a', 'b', 'c'], 0b00) == ['a b c']
         selective_join(['a', 'b', 'c'], 0b01) == ['a', 'b c']
         selective_join(['a', 'b', 'c'], 0b10) == ['a b', 'c']
         selective_join(['a', 'b', 'c'], 0b11) == ['a', 'b', 'c']

    This function is used as part of finding all the ways to split a string by spaces.

    :param parts: Strings to join
    :param n: Integer (bit map) to set the positions to join
    :return: resulting list of strings
    """
    result = []
    concatenated = [parts[0]]
    for part in parts[1:]:
        if n & 1:
            result.append(' '.join(concatenated))
            concatenated = [part]
        else:
            concatenated.append(part)
        n >>= 1
    if concatenated:
        result.append(' '.join(concatenated))
    return result