title: Code Implementation (Gunmen in Array)
body: <p>There is a room with n rows and n columns, and there are gunmen in the room.
  A gunman can see vertical or horizontal way, and cannot see over the wall or diagonal.
  If a gunman see another gunman, they will shoot each other and only one man will survive.
  We want all gunmen to be alive.
  ■: Wall
  □: Empty space
  ♂: Gunman
  For example, there is a room with 4 rows and 4 columns,</p>
  
  <p>■■■□</p>
  
  <p>□□□□</p>
  
  <p>□■□□</p>
  
  <p>■■■□</p>
  
  <p>we can place 3 gunmen like below.</p>
  
  <p>■■■□</p>
  
  <p>□□□♂</p>
  
  <p>♂■♂□</p>
  
  <p>■■■□</p>
  
  <p>However, we cannot place gunmen like below, because they are in the same line horizontally, one man will die.</p>
  
  <p>■■■□</p>
  
  <p>□♂□♂</p>
  
  <p>□■□□</p>
  
  <p>■■■□</p>
  
  <p>We can place maximum 4 gunmen in this room, and there are 2 ways to achieve this.</p>
  
  <p>■■■♂</p>
  
  <p>□♂□□</p>
  
  <p>♂■♂□</p>
  
  <p>■■■□</p>
  
  <p>2nd</p>
  
  <p>■■■□</p>
  
  <p>□♂□□</p>
  
  <p>♂■♂□</p>
  
  <p>■■■♂</p>
  
  <p>could you help to write a program to calculate
  1. The maximum number of gunmen we can place in the room below?
  2. The number of ways to place gunmen in question 1?</p>
  
  <p>thank you</p>