The minimum size for an adult corn is a 20 gallon tank, 30" x 12" x 12", but if your building the enclosure build it bigger for the snake's sake. A little extra space will do a lot of good for the snake. They'll have a little more roaming space, get a little more exercise, and maybe have a little more fun in a larger enclosure. I keep my snakes in 20 gallon tanks but bigger is better.
2 feet by 18 inches is close to the same area as the 20 gallon, but I'd make it bigger, maybe 3' by 18". That will comfortably house a corn for it's whole life, but as a hatchling you will need to give the snake lots of hides and fake plants or other cover to make the small snake feel safer in a large tank.