New York City police said a man has been linked to four unprovoked attacks in Queens and a suspected stabbing in a Brooklyn subway.