Lego tower problem

Question

Hints

Answer