题解 | 提取不重复的整数
提取不重复的整数
https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
public static void ExtractUniqueNumbers() {
Scanner sc = new Scanner(System.in);
int a= sc.nextInt();
Set<Integer> keys = new HashSet<>();
int res=0;
while (a!=0){
int b=a%10;
if(keys.add(b)){
res=res*10+b;
}
a=a/10;
}
System.out.println(res);
}
刷着玩刷着玩 文章被收录于专栏
刷着玩刷着玩