Finding elements from 1 st array ( non duplicates only ) . Using another array for storing union elements of both arrays Assuming max element present in array is not more than 10 ^ 7
int newtable [ ] = new int [ ans + 1 ] ;