LeetCode刷题笔记-8.字符串转整数
LeetCode刷题笔记-8.字符串转整数
C代码注意点结果
题目
C代码
enum STATE {
START = 0,
SIGNED,
START_ZERO,
NUM,
END
};
enum STATE get_next_state(enum STATE cur, char c) {
if (cur == END) {
return END;
}
if (cur == START_ZERO) {
switch(c) {
case '0':
return START_ZERO;
case '1'...'9':
return NUM;
default:
共有 0 条评论