Yes, you're right. I misremembered the problem and thought a greedy algorithm would work in that case.
It still seems to me that bowl-stacking is solved by sorting alone, though, which is of course much simpler.
It still seems to me that bowl-stacking is solved by sorting alone, though, which is of course much simpler.