Back to problems

Find Words That Are Substrings of Other Words

Algorithm · Meta · Medium

Problem Given an array of lowercase strings words, which may include duplicate entries, return every word that occurs as a substring of another word in the array. The result must contain no duplicates, and its ordering is unrestricted. Requirements Describe a straightforward baseline solution and analyze its time and space usage. Describe an optimized method, state its expected time and space complexity, and implement it. Use this function signature: Constraints 1 <=…

Checking your access…