Interview Question


Country: United States




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

Activity Selection Problem

Classic greedy algorithm....

- srdjan March 29, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 3 votes

Eh?

First, the problem is quite vague.

Second, the greedy algorithm for activity selection applies when there is only one processor. For more processor, I believe it is NP-Hard.

- Le snob. March 30, 2014 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

sort the n meeting according to their end times
Keep assigning the 1...n meetings to the first of the meeting room 1..m which is free

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

Who said you were given start times?
Can you prove your strategy works?
What does "works" mean in this question?
How does one define optimal for such a vague question?

- Anonymous March 30, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

meetings will have start and end times... This is the classic greedy problem - Inteval scheduling problem

- arsragavan March 30, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

can u prove that greedy works?

- Reena Malik March 31, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

u are just memorizing things , you have to state reasoning that is wat careercup is for

- Anonymous March 31, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Lets assume somethings...m==1, n==2 and all meetings start at the same time, with varying end times. In this case, sorting by end times => the shortest meeting gets the room first. The proposed algorithm seems like one based on the "Shortest Job Next" algorithm. In this algo, the advantage is that the average wait times are minimized. If we assume meeting times and durations are known, this algorithm seems to work in my opinion.

- smallchallenges March 31, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

is this binpacking?

- Anonymous March 30, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

we can maintain m queues with n/m meetings in each queue. Use the FIFO to schedule the meeting. If one queue is empty we can reshedule the queue. This can be one of the solution. Ques never asked for optimal solution.

- ashishash09 April 25, 2014 | Flag Reply


Add a Comment
Name:

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

Books

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

Videos

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