programming twist




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

One idea:

Seems like an integer linear program.

x_i = 0 if the ith soldier is truthful, x_i = 1 otherwise.

You get m equations of the form x_A + .. + x_B = C

You have to maximize and minimize \sum x_i.

- Loler October 09, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

can u plz elaborate it??

- jayram singh October 10, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@jayram: Search the web for what an integer linear program is. All will be clear :-)

- Loler October 10, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Integer linear programming is NP-complete. You can derive approximation methods from it, but this problem asks for an exact solution. You need to use other techniques here.

- Anonymous October 10, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

yeah ! i solved it.

- jayram singh October 11, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

@Anonymous: This is just an instance of an integer linear program. There are special cases where it is solvable in polynomial time and this might be one of those.

Of course it was just an idea. Not claiming it is a good solution or anything.

- Loler October 11, 2012 | Flag




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