Messi
BAN USER
Comments (3)
Reputation 115
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
What about this?
1. Insert all the words in the dictionary in a trie, so the space will be the length of all the words in the dictionary. Now do a depth first search to find the longest word with every node having end of word character.
This will be order of O(N) solution, because you are only visiting each word only once.
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
If the webservice accepts arguments as part of the GET request, then you can use php with curl to test the webservice.
- Messi April 13, 2010