Hints: In first layer there are 3 cubes. In second layer there are 3 cubes visible but there are 3 cubes also hidden behind the first layer. So total number of cubes are 3+3+3