A man who carried out a string of stabbings across New York City, killing two people and critically wounding a third, had been arrested eight times in the past.