Taking Exam in one state but want to be lincensed for another state

Hey! Can someone help me? I am temporarily working in North Carolina for 3 months, passed two parts of the CPA exam in New York and want licensed in New York. If I take my last two exams in North Carolina can I still apply for a New York License? Does it not matter where I take my exams? Or do I have to take the exam in the state I want to be licensed in?