UBS interview question

SQL queries of finding duplicates