Algorithm: efficient way to remove duplicate integers from an array

前端 未结 30 2785
离开以前
离开以前 2020-11-22 16:03

I got this problem from an interview with Microsoft.

Given an array of random integers, write an algorithm in C that removes duplicated numbers an

30条回答
  •  佛祖请我去吃肉
    2020-11-22 16:19

    It'd be cool if you had a good DataStructure that could quickly tell if it contains an integer. Perhaps a tree of some sort.

    DataStructure elementsSeen = new DataStructure();
    int elementsRemoved = 0;
    for(int i=0;i

提交回复
热议问题