Company: Flipkart Grid SDEintern_18july

Difficulty: hard

Problem Statement

Satya is participating in a treasure hunt. The key to the last puzzle is the minimum number of nodes in a "prefix tree" made from a given set of words. She has the flexibility to rearrange the letters of the given words in any way possible, to try to minimize the number of nodes. Note that a word's prefix is a subarray of letters that starts from the beginning of the word to a specific point in the word. A prefix tree is a tree like structure that represents all prefixes of words from a certain set in the following way: The root of the tree represents an empty prefix. Each branch of the tree is denoted with a letter from the alphabet. Two branches coming out of a single node (or root) cannot be labeled with the same letter. All nodes (except root) in the tree represent a non-empty prefix obtained by concatenating letters of all branches that lead from the root to that node. The puzzle has N words that consist of lowercase letters of the English alphabet. Help Satya by writing a program

More Flipkart Grid SDEintern_18july OA questionsInterview experiences