The key to this answer is the strength of the forces of attraction in the different states of matter. Oxygen is a gas, water is a liquid and sugar is a solid.
Since sugar is a solid, the forces of attraction between the particles of sugar are strong.
Water is a liquid; the forces of attraction here are weaker than sugar.
Oxygen is a gas; the forces of attraction are the weakest in gases.
Thus, the increasing order of forces of attraction between the particles of water, sugar and oxygen is
Oxygen < Water < Sugar