I have a list of words, and a lot of posts. I have to check if any of those words are present in the post, if so, save it, and then go to the next, and so on.
I can change the list of n words in an hashmap so when I'll check I'll have O(1), but I have still to go through all the words in the single post [O(n)], and then to all the posts [O(n^2)].
Any suggestion to improve this?
Usually I wouldn't bother, but the number of posts is massive.