def partition_to_index(partition):
    """
    Convert a binary string of length n into an integer between 0 and 2^n - 1 inclusive.
    The binary string should contain only two types of characters: {F, B} or {L, R}, which
    act as instructions for a binary search through the list [0, ..., 2^n - 1].
    The characters F, L indicate that the output integer lies in the lower half of the range, whilst
    the chars B, R indicate that the output integer lies in the upper half.
    """
    # Initialise the search range containing the seat's row/column from 0 to 2^len(partition) - 1
    low, high = 0, (1 << len(partition)) - 1
    # Implement binary search-like algorithm with char check condition for moving left/right
    for c in partition:
        midpoint = low + (high - low) // 2
        if c in {'F', 'L'}:
            high = midpoint
        elif c in {'B', 'R'}:
            low = midpoint + 1
    # Check that we have narrowed down the search space to a single element (no unexpected characters)
    assert low == high
    # Return the search output
    return low