I guess the best option would be to use a List in this case instead of an array. You can add or remove items from a list during runtime and has much better handling than an array. To add items to a list, you can use Add To Collection activity. Another approach is to use the Invoke method to add items to a list.
And to remove duplicates in a list, you can easily use the below command in an assign activity
I have done a sample workflow for you on this. It adds items to a list, removes duplicates and gives out a output.
AddItemsToList.xaml (6.0 KB)
and later if you want to convert the list to an array, you can use:
Let know whether this works out for you.
If it works, please also make sure to mark my answer as the solution too to help others as well