Zscaler Hiring Challenge OA 2022 | Replace Words with Root (Trie-Based Stemmer)
ZScaler · Question · Posted Jun 2026
Problem Statement You are given a dictionary consisting of root words and a sentence containing multiple words. For every word in the sentence, if there exists a root word in the dictionary that is a prefix of that word, replace the word with the shortest matching root. Return the modified sentence after performing all replacements. Example 1 Input dictionary = ["cat", "bat", "rat"] sentence = "the cattle was rattled by the battery" Output the cat was rat by the bat ...
The full answer & interview discussion are available to premium members.
Log in Create a free account