Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    "One issue that you did not tackle is that songs end up being added to the set multiple times, for every occurence of the word in the song." This is a Set, not a List. If you try to add a duplicate element, it just returns false. Commented Nov 3, 2010 at 17:35
  • thats why I didn't use a conditional to check. both contains() and add() are O(logN). If the add were O(N), then I would use the check. Commented Nov 3, 2010 at 19:28
  • I marked the other answer the accepted answer because it helped me the most, but if possible I would have accepted yours as well. Thanks for showing me the reordering of the if statement Commented Nov 3, 2010 at 19:45