logo CodeStepByStep logo

RemoveDuplicates

Language/Type: C# Set List collections
Related Links:

Write a method named RemoveDuplicates that accepts as a parameter a List of integers, and modifies it by removing any duplicates. Note that the elements of the list are not in any particular order, so the duplicates might not occur consecutively. You should retain the original relative order of the elements. Use a set as auxiliary storage to help you solve this problem. For example, if a list named l stores {4, 0, 2, 9, 4, 7, 2, 0, 0, 9, 6, 6}, the call of RemoveDuplicates(l); should modify it to store {4, 0, 2, 9, 7, 6}.

Method: Write a C# method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.