Surya
BAN USER
- 1of 1 vote
AnswersGiven the two objects below, implement the methods defined in the Phonebook class. This is a simulated phonebook. You should expect LookupByName and LookupByPhoneNumber to be called much more often than AddPerson. Also, this is a multi-threaded simulation so your implementations of the functions other than the constructor should be threadsafe. Feel free to rewrite this in any language of your
choice.
- Surya in United States for Cloud servicespublic struct Person { string name; string phoneNumber; } public class Phonebook { public Phonebook (List<Person> people) { } public Person LookupByName(string name) { } public person LookupByphoneNumber(string phoneNumber) { } public void Addperson(person person) { } }
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Threads - 1of 1 vote
AnswersTruth Table implementation: Write a function which takes integer as In put parameter (let's say n), print all True (T) , False (F) combinations n times. Here is the example:
for n = 1
Output :
T
F
for n = 2
Output :
T F
F T
For n = 3
Output :
- Surya in United States for Mobile BIT T T T T F T F T T F F F T T F T F F F T F F F
| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm
Thanks for the responses. @zr.roman, I was wondering why you added TryRemove and TryAdd statements with If conditions. Because, the AddOrUpdate statements at the end will do the required updates. why we need to remove and add the items explicitly if we doing AddOrUpdate?
- Surya November 12, 2015
Very clear and simple solution. Thanks
- Surya November 25, 2015