Green Bricks Interview Question for Software Engineer / Developers


Team: test alpha
Country: United States
Interview Type: Written Test




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

The second sample input and output seems to be off. Shouldn't sample output for the input stream me WED THU and not TUE WED THU ?

- van May 30, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

in second case,
there are 2 courses to register.
again here

chemistry has tue wed thu and
english has tue wed thu

so both course full fill the requirement and the answer is
tue wed thu


i hope you will get your answer

- John May 30, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Covert Days of the week to the following

Sunday - 0
Monday - 1
Tuesday -2
Wednesday -3
Thursday - 4
Friday - 5
Saturday - 6

Now initialize Course[x][0], Course[x][1] and Course[x][2] as course X taken on the 3 days mentioned in the input.

int bestIndex=-1;


for(int i=1;i<1<<7;i++)
{
for(int j=0;j<Subjects.Length;j++)
{
if(i & 1<<Course[j][0] && i & 1<<Course[j][1] && i & 1<<Course[j][2] )
{
CourseIndex[i]=CourseIndex[i]+1
}
if(CourseIndex[i]>=m)
{
bestIndex=i;
}
}
}

- S June 02, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

this code is not seem to be fine.
Can u make the complete working code?

- Anonymous June 05, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

The fact that the space of possible outputs is so small immediately makes this problem trivial. Unless the required number of courses is 0, the number of possible sets of days that could be the answer is (7 pick 3) + (7 pick 4) + (7 pick 5) + (7 pick 6) + (7 pick 7) = 78. For each of the 78 possibilities, check them in order of size and see if they work. Output the first one that works.

- eugene.yarovoi June 14, 2012 | 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