The number of cubes in the given figure is sum of cubes in each layer.
Number of layers = 3
Number of cubes in top layer = 1
Number of cubes in middle layer = 2
Number of cubes in last layer = 3
⟹Total number of cuber = 1 + 2 + 3 = 6
For the given figure,