Dev Skill DCP-497: Exactly Two Times solution


Problem Link
Dev Skill DCP-497: Exactly Two Times solution
#include<iostream>
using namespace std;
int main()
{
    int t,n,a[10005],i,c,j;
    cin>>t;
    while(t--)
    {
        cin>>n;
        for(i=0; i<n; i++)
            cin>>a[i];
        for(j=0; j<n; j++)
        {
            for(i=j+1; i<n; i++)
            {
                if(a[j]==a[i])
                  {
                      cout<<a[j]<<endl;
                      break;
                  }
            }
        }
    }
    return 0;
}

No comments

Theme images by enjoynz. Powered by Blogger.