Skip to content

Latest commit

 

History

History

Count Ways to Build Street Under Given Constraints

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

There is a street of length n and as we know it has two sides. Therefore a total of 2 * n spots are available. In each of these spots either a house or an office can be built with following 2 restrictions:

  • No two offices on the same side of the street can be adjacent.
  • No two offices on different sides of the street can be exactly opposite to each other i.e. they can’t overlook each other.

There are no restrictions on building houses and each spot must either have a house or office.

Given length of the street n, find total number of ways to build the street.

Input : 2
Output : 7
Input : 3
Output : 17