Explain how limbless salamanders evolved according to Darwin's theory of natural selection?

Salamanders don't need legs in order to swim; therefore the limbs aren't necessary and gradually -- over hundreds of generations -- withered away because they were a hindrance to swimming.