Skip to content

Instantly share code, notes, and snippets.

@johirbuet johirbuet/
Created May 31, 2018

What would you like to do?
// Given an array of integers, remove all of the duplicates
int[] deDup(int[] a) {
Set<Integer> set = new LinkedHashSet<>();
for(int x : a) {
int [] ret = new int[set.size()];
int i =0;
for(int x : set) {
ret[i++] = x;
return ret;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.