The question asks the number of possible binary arrays (lets call it nums) of length n that meets the following conditions:
- nums.size() = n;
- nums[0] = nums[n-1] = 0;
- nums[i] (0 <= i < n) can only be 0 or 1
- length of consecutive 0s or 1s cannot exceed 3 (i.e. you cannot have ...0000... or ...1111....in the array)
For example:
n = 3, we have 000, 010, a total of 2 possible arrays
n = 4, we have 0010, 0100, 0110, a total of 3 possible arrays