题解 | #序列找数#

序列找数

http://www.nowcoder.com/practice/a7d1856a72404ea69fdfb5786d65539c

import java.util.*;
public class Main{
  public static void main(String[] args){
      setTest();
}
  public static void setTest(){
      Set<Integer> set=new HashSet<>();
      Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();
      int i=0;
      while(sc.hasNext())
          set.add(sc.nextInt());
      for(i=0;i<n;i++)
      {
          if(set.contains((i)))
              continue;
          else
              break;
      }
      System.out.println(i);
  }
}
全部评论

相关推荐

05-18 12:59
已编辑
东南大学 人工智能
夜晚的精灵:熟悉transformer架构,熟悉机器学习,强化学习这些都可以写上去
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务