Java Array, Finding Duplicates

前端 未结 14 1227
闹比i
闹比i 2020-11-22 09:13

I have an array, and am looking for duplicates.

duplicates = false;
for(j = 0; j < zipcodeList.length; j++){
    for(k = 0; k < zipcodeList.length; k++         


        
14条回答
  •  我在风中等你
    2020-11-22 09:42

    Print all the duplicate elements. Output -1 when no repeating elements are found.

    import java.util.*;
    
    public class PrintDuplicate {
    
        public static void main(String args[]){
            HashMap h = new HashMap();
    
    
            Scanner s=new Scanner(System.in);
            int ii=s.nextInt();
            int k=s.nextInt();
            int[] arr=new  int[k];
            int[] arr1=new  int[k];
            int l=0;
            for(int i=0; i0)
            { 
                for(int i=0;i

提交回复
热议问题