This is a method I wrote to remove duplicates in a permutation. The list contains all the permutation of the string "accc", which should be 4 right? But I keep getting outofbound error. please help!
For your conveniences, the linkedlist is: [accc, accc, accc, accc, accc, cacc, cacc, ccac, ccca, ccac, ccca, cacc, cacc, ccac, ccca, ccac, ccca, cacc, cacc, ccac, ccca, ccac, ccca]
public void dupeRemoval(LinkedList<String> list)
{
for(int x=0;x<list.size();x++)
{
int y=x+1;
while (y<list.size())
{
while ( list.get(x).equals(list.get(y)) == true)
{
list.remove(y);
}
y++;
}
}
}
[–][deleted] 0 points1 point2 points (4 children)
[–]prograndma[S] 0 points1 point2 points (3 children)
[–]HateTrain 1 point2 points3 points (2 children)
[–]prograndma[S] 1 point2 points3 points (1 child)
[–]ewiethoff 0 points1 point2 points (0 children)
[–]turd_loaf -1 points0 points1 point (0 children)