When an object vibrates, it forces the particles of medium around it to also vibrate.
They cause the neighbouring particles to vibrate and so on.
Since the solids are tightly packed, the vibrations are transferred faster.
Liquids are little less packed than solids but more packed than gases.
Hence, speed of sound in liquids lie between that of solids and gases.
And sound travels the slowest in gases.
Hence, the speed of sound is fastest in solid, followed by liquids and then gases.
Sound doesn’t travel in vacuum.
Speed travels fastest in glass