0
$\begingroup$

Find the number of possible team arrangements given a team size N and two possible teams A and B with constraints on the number of consecutive As and Bs allowed.

Example: N= 4

A constraint: 3

B constraint: 2

A constraint means there must be fewer than 3 consecutive As. B constraint means there must be fewer than 2 consecutive Bs. Team size of 4

Possible combinations:

AABA

BAAB

ABAA

BABA

ABAB

Therefore the program program should return 5.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.