Microsoft Interview Question for Software Engineer / Developers

Comment hidden because of low score. Click to expand.
of 0 vote

Hey, I'd use hash table with key being user id and value an object like {int count, max_count} then on each new call I'd increase "count" for calling user and update max_count if count became more than it. On hangup I just decrease count. On 24 hour boundary hashtable is dumped and users are billed according to that data. O(n) runtime and O(n) memory I guess :)

- Giorgi March 29, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 votes

Hey, good idea! I would clarify this with the interviewer (I did during the interview) - the data shouldn't be collected in real time. It will be given as the following (though you were supposed to derive this struct in some form or another for the first part of the interview):

Also, just to make life easier, you can assume that all of the data being fed to you is already constrained to one customer of interest. Work with the following structure (assume you are given a list of the following structure):

typedef struct phone_call {
unsigned user_id; /* arbitrary since all data being fed is for one customer */
unsigned int start_time;
unsigned int call_length;
} phone_call;

- woohoo March 29, 2011 | Flag
Comment hidden because of low score. Click to expand.
of 0 votes

Well, in that case the algo would be O(N) no more, as in case of input of format you specified, You'd need nlogn time to sort call start time and end time along the timeline. For this case I think the format like

  uint32_t user_id;

would be better. The satellite would have to log these actions into simple file, each new action would be simply appended to the end of file. Then processing would require traversal of this file from start to end i.e. linear time again :)

- Giorgi March 29, 2011 | Flag

Add a Comment

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.


is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More


CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More