This problem appears as a warm-up question at Amazon, Google, and Microsoft. It's often the first problem in a phone screen to ease you into coding. The real value is the trade-off discussion. Interviewers want to hear you compare sorting ( time, space) versus hashing ( time, space). If you can articulate this trade-off clearly, you've demonstrated algorithmic thinking. It's also a building block. Once you know how to detect duplicates, you can solve "find the duplicate number," "find all duplicates," and "contains duplicate within k distance."
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/maang-interview-prep/arrays-hashing/contains-duplicate-why-this-problem
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████████████████████████████████████████████████████████████████████████████████████████████████