Add comments, C++, and Python solutions.