Two requirements must be met:
1. Your physical presence in US must be at least cumulative 30 months during the lastest five years before you file N-400;
2. Your continuous residence must not be disrupted, i.e. if your stay outside US for > 6 months continuously, it may be disrupted; and if your stay outside US for > one year continuously, it will be disrupted unless you worked for a US employer and the employer filed N-470 for you.
See this link: