TopCoder Range Minimum Query and Lowest Common Ancestor