Samsung Electronics interview question

Convert string to int