How can write a function to find unique elements in array without any allocation?

from the docs, try:

a = rand(10000)
sort!(a)
unique!(a)

rand(10000) is a bad example as is probably unique anyway, but it’s a step.
Other option is using Set(a)

3 Likes