Yes with ES6+ we can use the ability of a set.
The problem statement specifies without any extra space. A set when created in ES6+ will use extra memory and will take O(N) time. Converting a set back to array will add O(N) time.
The array here is small, imagine if we have to run the set logic on huge array.