He stated that his original ambition was to become a mathematician and that he became a composer largely by chance. A big influence was the fact that famed lyricist
Oscar Hammerstein II (of Rodgers & Hammerstein) was a neighbor of his when Sondheim was a boy. When he wrote a musical for a school production, he showed it to Hammerstein who told him it was the worst musical he had ever read. However, Hammerstein also told him that nonetheless it showed a lot of latent talent and proceeded to tell him everything that was wrong with it and how to fix it, for which Sondheim was always grateful.