Solutions to problems from Programming Interviews Exposed, 3rd ed.