Tallest Tower by Stacking Blocks
Given a collection of block types each defined by a count, weight, and maximum supported weight, determine the maximum number of blocks that can be stacked into a tower where no block exceeds its supported weight limit from the total weight of all blocks above it including itself.
Asked at:
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid June, 2026
Staff
You're building the tallest possible tower from a collection of blocks. You have several block types; for each type you're given three integers: <number_of_blocks> <weight> <max_support_weight> - number_of_blocks — how many blocks of this type you have - weight — the weight of one such block - max_support_weight — the maximum weight this block can support above it, including its own weight Every block is 1 meter tall, so a taller tower simply means more blocks stacked. A block is valid in the tower only if the total weight resting on it (everything above it plus itself) does not exceed its max_support_weight. Return the height (number of blocks) of the tallest tower you can build. Example Input # <number_of_blocks> <weight> <max_support_weight> 1 2 2 // type A 6 3 24 // type B 40 5 200 // type C Output 43
Hello Interview Premium
Your account is free and you can post anonymously if you choose.