RSS DEV Community

Scenario based java interview question

Finding Duplicates in a List Question: You have a list of integers, and you want to find any duplicates in that list.  Which collection would you use for efficient duplicate detection? Answer: I would use a HashSet to track seen integers while iterating through the list.  If an integer already exists in the HashSet, it is a duplicate ...
dev.to
dev.to
Create attached notes ...