Hint vs Python solution

In first hint it is stated that there should not be conversion to string, but in Python solution it is converted.

I’m a bit confused. Why there is wrong solution in Python?

Click here to start solving coding interview questions