Interview Question
Country: United States
The only thing that comes to mind is a hash of the customer's unique identifier.
The hash would be ideally 7 digits. The identifier would be something like their passport number or drivers licences. This is how Gravatar ensures profile avatars to be unique.
First there has to common repository for all the telephone number allocated... So a hosted ditributed cache server, a memcached can be used.. Memcached is a no-sql distributed in memory db.. Here a key is the telephone number value could be 0.
Now when a new telephone number has to be issued, an application will make HTTP / TCP/IP call. Will call the server asking for a permission.. Over HTTP or TCP/IP I dont care, HTTP is better as port and other crap you dont have to worry..and you dont have to write a client.. So your server is just a web server listining on 80 port.. Your web server will get the request, it will contact memcached servers for validation..If telephone number is avialable, it will return 200 OK else returns 201 OK. Its not as simple as it sounds as you will have to write an apache plugin...
First there has to common repository for all the telephone number allocated... So a hosted ditributed cache server, a memcached can be used.. Memcached is a no-sql distributed in memory db.. Here a key is the telephone number value could be 0.
Now when a new telephone number has to be issued, an application will make HTTP / TCP/IP call. Will call the server asking for a permission.. Over HTTP or TCP/IP I dont care, HTTP is better as port and other crap you dont have to worry..and you dont have to write a client.. So your server is just a web server listining on 80 port.. Your web server will get the request, it will contact memcached servers for validation..If telephone number is avialable, it will return 200 OK else returns 201 OK. Its not as simple as it sounds as you will have to write an apache plugin...
How about using set data structures??
- rajagopalshyam1994 September 06, 2012It would remove duplicates automatically.