A teenager accused of attacking three policemen with a machete on New Year’s Eve near Times Square was charged with attempted murder and attempted assault, New York police said on Monday, in an incident the New York Times said was linked to Islamic extremism.