MathDB
Putnam 1996 B5

Source:

June 6, 2014
Putnamfloor functioncollege contests

Problem Statement

Given a finite binary string SS of symbols X,OX,O we define Δ(S)=n(X)n(O)\Delta(S)=n(X)-n(O) where n(X),n(O)n(X),n(O) respectively denote number of XX's and OO's in a string. For example Δ(XOOXOOX)=34=1\Delta(XOOXOOX)=3-4=-1. We call a string SS \emph{balanced} if every substring TT of SS has 2Δ(T)2-2\le \Delta(T)\le 2. Find number of balanced strings of length nn.