1. some questions about networking. 2. Algorithm question: We have a string (lets call it main string), its format is like following: a/b/c/... (where a,b,c could be a world and "a" is level 1, "b" is level 2 and etc. Ex: animal/pet/dog L1 L2 L3 we have a list of input strings with same structure. check which one if them is a match to the main string. we need to start checking from level 1. animal/pet/dog/white --> is a match animal/pet/cat --> is not a match pet/animal/dog/ --> is not a match animal/pet --> is not a match 3. Imagine you have the best algorithm for this problem (in term of time and memory complexity), how would you make it run even faster?
Anonymous
1. I answer those questions based on my knowledge. 2. Briefly, I said I would use a hash table to add main string words and their level into it (like pair ) and then I will iterate over input strings words and check if their words are in the hash and if they have a same level like the main string. Hash Table would be like: Then I discussed the time and memory complexity of my idea. 3. I said since the input strings checking process is independent from each other, we can use multi-treading.
Check out your Company Bowl for anonymous work chats.