Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.
Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are responsible to gather all the input requirements up front.
本文介绍了一个使用简单状态机实现字符串转换为整数的方法(atoi)。重点在于处理各种输入情况,包括正负号、非数字字符及溢出判断。
353

被折叠的 条评论
为什么被折叠?



