How do I remove duplicates from a C# array?

后端 未结 27 2684
北海茫月
北海茫月 2020-11-22 07:53

I have been working with a string[] array in C# that gets returned from a function call. I could possibly cast to a Generic collection, but I was w

27条回答
  •  無奈伤痛
    2020-11-22 08:46

    Below is an simple logic in java you traverse elements of array twice and if you see any same element you assign zero to it plus you don't touch the index of element you are comparing.

    import java.util.*;
    class removeDuplicate{
    int [] y ;
    
    public removeDuplicate(int[] array){
        y=array;
    
        for(int b=0;b

提交回复
热议问题