educative.io

Time complexity of Search Suggestions

The time complexity of this solution is O(n), where is the total number of characters in the products array.

The solution begins by sorting the products array. Would this take O(nplogp) time, where p is the number of products, bringing our total time complexity to O(nplogp)?


Course: Grokking Coding Interview Patterns in Python - AI-Powered Learning for Developers
Lesson: Solution: Search Suggestions System - Grokking Coding Interview Patterns in Python