I have tried to solve by hashing and return via dynamic array.
but facing error in test case:
14  
12 7 5 1 13 1 10 8 11 9 2 4 3 6  
Correct output is:
1 14  
And my code's output is:
1 0
else all outputs are correct by far. Here is my code:
int *findTwoElement(int *arr, int n) {
    int *res=new int(2);
    int hsh[n]={0};
    int mini;
    for(int i=1;i<=n;i++)
        {
            hsh[arr[i-1]]++;
        }
     for(int i=1;i<=n;i++)
     {
        if(hsh[i]>1)
              {
                  mini=min(mini,i);
                  res[0]=mini;
              }
        if(hsh[i]==0)
              {
                  res[1]=i;
              }
            
     }
   return res;
}
 
    