字符串中不同整数的数目

 

 

 

思路:遍历一次字符串,当遍历到字符为数字时,计算数值(number = number*10 + (word.charAt(i)-'0');),知道遍历到字符不为数字,将数值加入hash集合。
遍历到字符不为数字时,继续遍历。

 

 

posted @ 2021-03-28 16:08  鼬神无悔  阅读(84)  评论(0)    收藏  举报