Do a lot of practice problems. There are plenty in the book "Cracking the Coding Interview" Use the tools you'll be expected to use for an interview with one of the top 4 companies (i.e. internet text pad, pen and paper, whiteboard) Do several problems every day and you'll be ready in a few months. Make it your 9-5 and you can be ready in a few weeks.
It's all about practice! Good luck!
Also, if you can get in touch with a recruiter at those companies, they'll give you tons of helpful tips (mostly just how to practice and what to practice)