Java Arraylist Find Duplicates Leetcode Premium