This is why I usually front-load my 401k contributions towards the beginning of the year. That way, if I unexpectedly change jobs, and the new job has a 12-month waiting period, you can usually max out 401k contributions, or come close, for both years.
On the flip side, some companies do their 401k matching such that if you don't spread out your 401k contributions evenly throughout the year, you miss out on the match: If you contribute 6% you get a 3% match. Simple right? Well, some companies will just match 50% of your contribution per paycheck until they hit the 3%. Other companies will put in 3% if you put in at least 6% of your paycheck. Meaning if you front load, you won't maximize the match.
So if you've front loaded, and then switched jobs to a place that offers a better match, distributed through the latter method mentioned above, you're missing out on match for that first year.
But assuming your company does your match in the former method, and you don't change jobs all that often, you will come out ahead most years by front loading.