Interview Question: Distributing Image Heights Into 3 Balanced Column
144
Oct 14, 2026
I was recently asked this question in an interview:
"Write a function that takes an array of integers representing image heights and sorts them into 3 columns such that the height of each column is roughly equal."
For example:
int[] heights = {8, 7, 6, 5, 4, 3};The goal is to distribute the images across 3 columns so that their total heights are as balanced as possible.
My initial approach would be to sort the heights in descending order and repeatedly place the next image into the column with the smallest current total height.
However, I'm curious about a few things:
- Is this considered an easy, medium, or hard interview question?
- Is the greedy approach sufficient, or would you use a different algorithm to get a more optimal result?
- What would be the expected time and space complexity for a good solution?
I'd love to hear how others would approach this problem, especially those who have encountered similar questions in interviews.
Comments (3)


