Practo Interview Question for SDE1s
- 0of 0 votes
StringChain- rayasamharish October 04, 2015 in India
You are given a library with n words (w, w, ..., w[n - 1]). You
choose a word from it, and in each step, remove one letter from this
word only if doing so yields a another word in the library. What is the
longest possible chain of these removal steps?
1 ≤ n ≤ 50000
1 ≤ the length of each string in w ≤ 50
Each string composed of lowercase ascii letters only.
Complete the function "longest_chain" which contains an array of
strings "w" as its argument.
Return a single integer that represents the length of the longest chain of
character removals possible.
Sample Input #00:
Sample Output #00:
| Report Duplicate | Flag | PURGE
Interview Type: Written Test
Open Chat in New Window