c# - Get all duplicates from the array without traversing more than 1 -


i have integer array list int[] marks = {2,3,4,5,4,5,6,2,9};

i want duplicate in list , array shold traverse once. no inbuild function should use becasue every inbuild function traverse every serch.

expected result should 2,4,5

well, long qualification can traverse list once, create 2 more lists, 1 non-duplicates , 1 duplicates.

iterate through input list, , check if non-duplicates has int. if not, add it, if so, add dups if doesn't contain it. in end, dups should have requested result.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -