Just a few days ago I discovered Codility, and I tried their challenges. And I must say. I got my behind handed to me on a platter. I'm not sure what the problem was, but I'll lick my wounds and wait for the solution to come out and compare it with my own. In the meantime, I want to get ready for the next challenge so I'm reading their previous blog posts and seeing how to solve their previous problems. There are a lot of new things I haven't heard about like (Cartesian trees, various sort algorithms, etc.)
So, how does one prepare for such challenges (especially the O(x) time and space complexity). What should I read to prepare for such a task?