Find unique numbers in array

后端 未结 8 1304
被撕碎了的回忆
被撕碎了的回忆 2021-02-04 20:14

Well, I have to find how many different numbers are in an array.

For example if array is: 1 9 4 5 8 3 1 3 5

The output should be 6, because 1,9,4,5,8,3 are uniqu

8条回答
  •  我寻月下人不归
    2021-02-04 20:35

    this should work, however its probably not the optimum solution.

    #include 
    
    using namespace std;
    
    int main()
    {
    int a[50],n;        
    int uniqueNumbers; // this will be the total numbers entered and we will -- it
    cin >>n;    
    uniqueNumbers = n;  
    for(int i=0;i> a[i];
    }   
    for (int j=0;j

提交回复
热议问题