solution found: How to detect which elements in an array have duplicates - #3 by anonymous_user_40d8c188