Finding repeated items in a array using array manipulation methods

In reply to sasi_8985:

You could be using all the possible array method locators or alternatively some queue support:


module tb;
 
  int c[$] = '{1,3,1,2,3,6};
  int res[$];
  initial
    begin
      c.sort(); // ordering
      // this will give you the unique string
//       $display("unique %p",c.unique());
      // OR
      foreach(c[jj]) begin
        res = c.find_index with ( item == c[jj] );
        if(res.size()>1) begin
          c.delete(res[0]); // delete to avoid reiterating
          $display("size: %0d -> c[%0d] -> %0d",res.size(),jj,c[jj]);
          $display("DUPLICATED");
          res  = {}; // empty
        end
      end
    end
endmodule

There could be many solutions, using and without using the array methods. Regards