TITLE: How many barcodes are there?
QUESTION [13 upvotes]: A barcode is made of white and black lines. A barcode always begins and ends width a black line. Each line has is of thickness 1 or 2, and the whole barcode is of thickness 12. 
How many different barcodes are there (we read a barcode from left to right).
I know that I'm required to show some effort, yet I really don't have a clue about this problem. Can you give me any hints?

REPLY [11 votes]: Denote by $b_i$ the number of bars (black or white) of width $i\in\{1,2\}$. Then $b_1+2b_2=12$, hence $b_1$ is even. Since the total number of bars $b_1+b_2$ is odd it follows that $b_2$ is odd. This leaves the cases
$$(b_1,b_2)\in\bigl\{(10,1),(6,3),(2,5)\bigr\}\ .$$
The total number of admissible arrangements then comes to
$${11\choose 1}+{9\choose 3}+{7\choose 2}=116\ .$$