One of the famous interview question is:
This is one of the famous interview question of all times.
How do you find the duplicate number on a given integer array?
If you have an array which contains duplicate values and you wish to remove the duplicates - in other words if you want distinct values in your array - then
Set comes to the rescue.
You must have seen this question in many of the interviews related to programming. This can be implemented in any language and using so many approaches. The solution I suggest is: