0 out of 464 challenges solved
Write a function `count_balanced_binary_sequences(n)` that calculates the number of binary sequences of length `2n` such that the sum of the first `n` bits is equal to the sum of the last `n` bits. #### Example Usage ```python [main.nopy] count_balanced_binary_sequences(1) # Output: 2 count_balanced_binary_sequences(2) # Output: 6 count_balanced_binary_sequences(3) # Output: 20 ```
def count_balanced_binary_sequences(n):
"""
Calculate the number of binary sequences of length 2n such that the sum of the first n bits
is equal to the sum of the last n bits.
Args:
n (int): The half-length of the binary sequence.
Returns:
int: The count of such balanced binary sequences.
"""
# Placeholder for the solution
pass