The 18-year-old, radicalized online, was planning a New Year’s Eve attack in a Charlotte suburb, officials said.