
Hi Community members,
A solution to last week’s challenge can be found here.
This challenge was submitted by Kosuke Uchihashi @KosukeUchihashi . Thank you, Kosuke, for this super interesting challenge!
In this week’s challenge, you are asked to build a tower by piling up a blocks. Each block has its own weight, load capacity, and height. The total weight of blocks piled on top of a block cannot exceed the load capacity of the bottom block.
The dataset contains the following information:
- BlockID: Letter used to identify the block.
- Weight: How much the block weighs.
- LoadCapacity: The total load the block can take when other blocks are piled on top of it.
- Height: How tall the block is.
Your task for this challenge is to create an iterative macro that produces all buildable towers from the 26 blocks provided. Build towers by starting with single blocks and adding one block at a time, as long as the tower remains valid.
You must configure your iterative macro to run a maximum of 100 cycles, where each cycle builds upon valid towers from the previous iteration.
A tower is valid as long as every block can support the total weight of all blocks stacked above it (i.e., a block’s LoadCapacity must be ≥ the cumulative weight of blocks placed on top of it).
As an example, you are given 3 blocks named A, B, and C, as shown in this table:
BlockID | Weight | LoadCapacity | Height |
A | 1 | 3 | 2 |
B | 2 | 4 | 5 |
C | 3 | 5 | 6 |
In this example, you can build a tower with a height of 13 by piling up A, B, and C while respecting the load capacities.
Need a refresher? Review the following lessons in Academy to gear up:
Good luck!
The Academy Team