Stacking Disks Problem

I was looking at the solution to Disk stacking problem.

image

Could somene explain why do we need to sort the disks first? In the solution the array is sorted on basis of height at the start.

I could post the solution if necessary.

Comments (8)