Today I tried to solve the Facebook Programming Program . The task I received is the Bar problem, which can be found here . My problem during the call was to understand the first example they provided.
The task can be summarized as follows:
FriendsN play a game. Each of them has a list of numbers in front of them.
Each of N friends selects a number from his list and informs the game administrator about it. Then the game administrator sorts the reported numbers and screams the largest number of Kth.
You want to know the score of all possible numbers that the game administrator can scream.
At this point, I thought I understood the problem, but then presented the following example:
In the above example, the examples for the first test are N = 3 and K = 3. The list for the first person is {2 5 3}, {8 1 6} for the second and {7 4 9} for the third. In this case, all numbers in {4, 5, 6, 7, 8, 9} have a chance to become the third largest selected number.
So my question is:
How will 7, 8 and 9 be the third largest selected number?
In my opinion, only the numbers {1, 2, 3, 4, 5} can be the third largest number, but maybe I misunderstood the algorithm.
snrlx source share