leetcode--String to Integer (atoi)
来源:互联网 发布:黑马程序员52期百度云 编辑:程序博客网 时间:2024/05/18 00:15
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.
思路:题目不是很难,但是有很多特殊输入要考虑
1.数字前面有空格 如s=“ 123456”2.数字前出现了不必要或多于的字符导致数字认证错误,输出0 如s=“ b1234” ,s=“ ++1233” , s=“ +-1121”
3.数字中出现了不必要的字符,返回字符前的数字 如s=“ 12a12” , s=“ 123 123”
4.数字越界 超过了范围(-2147483648--2147483647) 若超过了负数的 输出-2147483648 超过了正数的输出2147483647
原文链接http://blog.csdn.net/crazy__chen/article/details/45726773
阅读全文
0 0
- LeetCode:String to Integer (atoi)
- LeetCode: String to Integer (atoi)
- LeetCode String to Integer(atoi)
- LeetCode :String to Integer (atoi)
- Leetcode: String to Integer (atoi)
- Leetcode : String to Integer (atoi)
- 【leetcode】String to Integer (atoi)
- [LeetCode]String to Integer (atoi)
- LeetCode-String to Integer (atoi)
- [leetcode] String to Integer (atoi)
- LeetCode - String to Integer (atoi)
- 【leetcode】String to Integer (atoi)
- LeetCode - String to Integer (atoi)
- LeetCode: String to Integer (atoi)
- Leetcode: String to Integer (atoi)
- [LeetCode] String to Integer (atoi)
- leetcode String to Integer (atoi)
- [LeetCode]String to Integer (atoi)
- day7数组以及冒泡排序
- Serverless 是什么?又不是什么?
- NLP with deep learning(一) word2vec——词向量和语言模型
- 实现html页面的参数传递
- Squares POJ
- leetcode--String to Integer (atoi)
- 浅析Android字体加载原理
- Windows 下Hadoop的环境变量配置
- WebRTC中丢包重传机制的实现
- MySQL innodb waiting for table level lock 问题解决
- POJ1363
- Golang Protobuf
- Keras模块简述
- LintCode-字符串置换