/**
*
* @param str string字符串
* @return int整型
*/
function atoi( str ) {
// write code here
if(!str) return 0;
str = str.trim()
if(str.length){
var res = parseInt(str)
const min = Math.pow(-2,31)
const max = Math.pow(2,31)-1
if(res<min){
return min
}
if(res>max){
return max
}
}
return res
}
module.exports = {
atoi : atoi
};

京公网安备 11010502036488号