1 min readApr 1, 2020
You might consider using specialized data structures like Tries or suffix trees specifically meant to address scenarios like type ahead, auto-complete, dictionary search etc. Using contains on a list has a time-complexity of O(n) and might not be very performant for repeated searching in large lists