by qntm · 14y ago · 0 comments
Build a finite state machine which only accepts the terms in the blacklist. That should be a one-time operation.
Then feed each request into the FSM and see if you get a match. Execution time is linear in the length of the request, regardless of the number of terms in the blacklist.
There's no need to program like it's 1985 any more.