Interview Question for Front-end Software Engineers


Country: India
Interview Type: Written Test




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

the sum of all the winnings should sum up to Choose(N,2). Say, current sum is NN (without the -1 values). Compute S = Choose(N,2)- NN. M is the number of persons with -1. The answer is: Choose(S+M-1, S).

- mystique December 21, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Your solution, is not right, first of all, variables mustn't be bigger than n - 1.
Second, it is not sufficient, that sum equals (n, 2).

For example, n = 4, then (n, 2) = 4 * 3 / 2 = 6
But this test will not work,
3 3 0 0
their sum is 6, but 2 players win others, which is not possible.

- Madiyar July 31, 2014 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

WHY THE F do people post programming contest problems?

- Anonymous December 20, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 vote

Here are some of my thoughts which in my opinion can be used for solving this problem:
Assuming that all players play with each other and each group consists N players:
1) Total number of scores for a particular group has to be equal N(N-1)/2 e.g
- N = 2 => total is 1
- N = 3 => total is 3
- N = 4 => total is 6
2) Max score for a particular player is N - 1 when he won all of his games
So:
For each group check if the following constraints are not violated.
If the group contains -1 values check all permutations of '-1' values replacing them with numbers from 0 - (N-1).
Sum number of all combinations which don't break constraints.

- thelineofcode December 20, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

There could only be at most one person whose score is 0.

- uuuouou December 20, 2013 | Flag
Comment hidden because of low score. Click to expand.
-2
of 2 votes

Yes, there can be one 0 and one max (N -1)

- thelineofcode December 20, 2013 | 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