Hello. Completed the phone screen with Block for a Full stack Engineer. The question asked was :
Have to build an autocorrect feature.
The first part was that we would have a list of allowed words in our dictionary. Given an input word, we have to check if the word exists/is allowed (check if its present in our allowed words dictionary)
For example : Dictionary has Cats, input word is cat - word is not allowed
The second part was : Given the same dictionary(case sensitive words), and an input word - return the autocorrected word (based on case) which is allowed, based on our dictionary of allowed words
For example : dictionary has Cats , the input word is CaTS. The autocorrected word would be Cats. If the input word does not match to any word in the dictionary, don't correct it:
My solution was to use a Trie data structure, with some modifications. Just got to know they're moving forward to the next round. But the interviewer's feedback mentioned that using a Trie was not the best approach, could do better than that. (Something on the lines of not being able to add a huge number of allowed words in the dictionary). Could anyone help me with an approach better than using Trie for this question