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

Receive udp packets in android gstreamer -

php - Extract Text from HTTP referer -

matplotlib - PYTHON: Annotate boxes disapear dependant on range -