IBM interview question

Standard coding questions related to algorithms. Their preferred language was C++ but I did code in Python.