batman87
BAN USER
Comments (4)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
public static int removeDuplicates(int[] input) {
int len = input.length;
int[] tmp = new int[len];
int totalRemaining = 0;
for (int i = 0; i < len; i++) {
int vInputItem = input[i];
int idx = vInputItem % len;
int v = tmp[idx];
if (v != vInputItem) {
tmp[idx] = vInputItem;
totalRemaining++;
}
}
return totalRemaining;
}
- batman87 July 12, 2019Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
- batman87 July 12, 2019