Discuss / Java / 练习一

练习一

Topic source

Carol-zyl

#1 Created at ... [Delete] [Delete and Lock User]
    static int findMissingNumber(int start, int end, List<Integer> list) {
        for(Iterator<Integer> li = list.iterator(); li.hasNext();){
           int num = li.next();
           while(start <= end){ 
             if(num == start) { 
               num = li.next(); 
               start++; 
               continue;
             }
             else{ return start;} 
           }
          
        }
        return 0;
    }


  • 1

Reply