Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEA
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:
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
Today is the LAST DAY of our contest! Thank you to all community members who already submitted ideas. If you still want to participate, submit your idea though the link below:
Read more about the contest here:
My solution. I just appended all of the blocks to try and build every possible tower. The new load capacity in every iteration is always the lowest one from the current tower, the heights just get added up.
C470
Macro
I got confused and created more work for myself - or rather my own challenge spin off. I mistakenly found the optimal combo to create the tallest tower assuming the sort order could change. Ooops. So my output has two solutions - one for the given challenge and one for what I made up 😜