r-chandra-1 / SEW

0 stars 0 forks source link

Assessment #1

Open CodeTestSEW opened 7 years ago

CodeTestSEW commented 7 years ago

Hi Ravi,

Good attempt but your answers are not correct.

1) Reversal of words is not required as you are trying to find words made of other words using the given word-list. 2) Sorting the word-list using a primary condition mentioned in problem statement might help you to get the 1st and 2nd largest words. 3) How will you write an efficient program to address the repetitive activity? Think about it.

Final output is expected in less than 30 seconds. Please look into the problem statement one more time and get back with your solution by 09/13/2017 12 pm PST.

Thanks, SEW Team

r-chandra-1 commented 7 years ago

Hi SEW Team,

  1. I am using reverse search for this below case. Suppose I have below words. rat cat catbat catbatrat

Clearly catbatrat is the longest word here but to the code that way I have, it finds cat, then doesn't find batrat so this word is eliminated. If I had the word bat in the list, then it will find cat, then bat, then rat and conclude this is a combination word.

When I do the reverse on such words, it get rat, then catbat and concludes this is a combination of catbat+rat.

But if the provided list has all combinations then I can eliminate the reverse match like you suggested. That will certainly speed up the process.

  1. I am not clear on what condition the file should be sorted on but it appears to be sorted already.

  2. I can definitely improve a couple of things and check the runtime.

CodeTestSEW commented 7 years ago

Hi Ravi,

  1. It means you need to improve your logic to handle such condition where there is a combination of more than two words.

  2. Think about what other type of sorting could be applied to find longest word.

  3. Sure, please provide with your updated solution.

Thanks, SEW Team.

r-chandra-1 commented 7 years ago

Improved the performance. It now takes about 2 seconds. My result electroencephalographically is the longest possible combination word electroencephalographic+ally (27 chars) This is longer than phosphatidylethanolamine (25 chars) which I get if I run forward only.