Amazon.com Inc. announced Tuesday New York City and a Northern Virginia suburb of Washington, D.C., would be homes for the company’s second and third headquarters, ending a more than yearlong public contest that began with 238 candidates and ended with a split of its so-called HQ2.