Remove duplicates from integer array

前端 未结 23 2413
执念已碎
执念已碎 2020-12-01 18:52

I having a problem with coding this:

Write a static method named removeDuplicates that takes as input an array of integers and returns as a result a new

23条回答
  •  难免孤独
    2020-12-01 19:35

    import java.util.*;

    public class Duplicates {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
    
        int [] myArray  = {1,3,2,4,3,2,3,4,5,6,7,6,5,4,3,4,5,6,76,5,4,3,4,4,5};
        List  myList = new ArrayList ();
        myList = removeDuplicates(myArray);
    
        //Printing Output   
        for (int k=0; k removeDuplicates(int[] myArray) {
        // TODO Auto-generated method stub
        Arrays.sort(myArray);
        List  myList = new ArrayList ();
        for (int i=0; i

    }

提交回复
热议问题