- Notifications
You must be signed in to change notification settings - Fork870
Open
Description
Hi!
I found a mistake in method removeDuplicates. Inside the for loops there is an if branch. This contains the following:list.remove(j);
It is wrong, because if you have the same items several times one after another, it will erase only the first one, but not the 2nd, because as you delete the first, the loop will increase value of j, and the 2nd one will not deleted. If you try it with a sample list like this: Chicago, Miami, Chicago, Chicago, Washington, the result will be: Chicago, Miami, Chicago, Washington.
You can correct it, if you decrease 'j' every time you delete an item from the list:list.remove(j--);
Bye,
Csaba
Metadata
Metadata
Assignees
Labels
No labels