The fact that you lived in two countries does not change the Physical presence test -- it is away from USA that counts.. Thus for the test period ( say ) for 2018, you use 01/01/2018 and 12/31/2018. In this period of 365 days if you stayed away from the USA for at 330 days , you meet the test and therefore eligible for Earned Income Exclusion. You use the country you were in on 12/31/2018 as your tax home.
Does that answer your query or do you need more help ? When you respond, please include the names of the two countries. I am also assuming that you are US citizen/Resident ( Green Card )