On video "solving the string challenge "

Intead of writing whole function of convertToInt
Can we simply witer a small command like
Ans=std::stoi(str)

Hi @vidhisareen24_b6d843b2819ebfc2,

It will give you an error, as the string length can be greater than 10.
So, you can use stoi only if you are sure that the length of str is less than or equal to 10.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.