This is a platform for preparing interview.
Users come here for solving these problems in a good way, not just get accepted.
Do you believe when you write such code in front of your interviewer you will get offer?
Of course it was accepted. The entire point of the question was "write atoi." You can mention "use atoi" if the question is convert a string to an int, but you have to actually show you know how it works in the interview.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.