猿问

求大佬帮忙,老师今天讲的太快,没懂,作业不会做

已知数据手机号数组:

String[] phones = {"13804010040","13804010041","13804010042",

"13804010043","13804010044","13804010045",

"13804010046","13804010047","13804010044",

"13804010054","13804010055","13804010056",

"13804010058","13804010059","13804010060",

"13804010061","13804010062","13804010063",

"13804010064","13804010065","13804010066",

"13804010067","13804010068","13804010069",

"13804010070","13804010071","13804010072",

"13804010073","13804010074","13804010075",

"13804010045","13804010057","13804010063",

"13804010058","13804010069","13804010066"}

  1. 1使用集合,快速去除重复的手机号,将去重后手机号存

放的List集合中,输出去重后有多少个手机号,13804010099这个手机号是否存在

 

  1. 2已知上面手机号数组,将数组转为集合,然后使用map集合存储每个手机号出现的次数,并遍历输出


崔佣幸
浏览 688回答 1
1回答

安浪创想

做个遍历,在遍历的函数之外放一个全局变量。遍历到了就改遍历函数外的全局变量。这是学习算法的,还是要靠自己的逻辑去实现。
随时随地看视频慕课网APP

相关分类

Java
我要回答