your solution looks fine but is a bit slower but still it gets the work done! so yeah the codes effective but not efficient.
!= is not the problem
!=
you are iterating through the friends list, and within the loop, removing items, which means that all items aren't looped through
friends
log the value of item before the if statement
item
better to use another list/algorithm
Loading collection data...
your solution looks fine but is a bit slower but still it gets the work done! so yeah the codes effective but not efficient.
!=
is not the problemyou are iterating through the
friends
list, and within the loop, removing items, which means that all items aren't looped throughlog the value of
item
before the if statementbetter to use another list/algorithm