So it could be that the Set solution is just as memory-efficient as the double-for loop. I'd love to do a benchmark of this.
If you do, please let me know what the results are!
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.