Probability - The hiring problem 
There will be $<$ positive integers. We take the version of the
hiring problem in which we open a team of $$ engineers in the company.
The company receives  candidates in random order. We will denote the
candidates by $_1,…,_$ where $_1$ is the worst and $_$ best.
First, the team is established with the participation of the first $$
candidates who come to the company. Then, for each new candidate $_$
: If $_$ is better than the worst candidate in the current team, then
he will join the team in his place.
For some $>−$, calculate the probability that $_$ will be a member of the team at some stage.

The set $a_{n-k+1},..,a_n$ we have $k$ candidates, thus space event is $k!$
for each $i =n-k+1,..,n$, we define $X_i$ the indicator function for event $a_i$ will be member of the team.
We need to calculate the probability $PR[X_i=1]= \frac{P(k, i-(n-k-1))*1*P(n-i,n-i)}{k!}=\frac{1}{n-i+1}$
Where, $P(k, i-(n-k-1)) $ is the permutation to select the candidates who are worse than $a_i$ and after that we select $a_i$ with 1 permuation and after we select the candidates who are better than $a_i$ which are the remaining $P(n-i,n-i)$
Is my attempt correct?
 A: We need the probability that candidate $i$ is among the top $k$ when they're considered. We can simplify the problem by observing that the positions of candidates $a_1, a_2, \cdots, a_{i-1}$ are totally irrelevant to whether $a_i$ gets hired, since $a_i$ will get hired exactly if the permutation places $< k$ higher-ranking candidates in front of $a_i$.
In other words, if we totally ignore the first $i-1$ candidates, then we care about whether candidate $a_i$ lands among the first $k$ out of the remaining $n-i+1$ candidates. If $k \ge n-i+1$ then our candidate will always get hired; otherwise the probability of success is $\frac{k}{n-i+1}$.
The logic in your attempt is also mostly correct. Your mistake is that you only consider cases where $a_i$ arrives before ANY of the higher-ranking candidates. Actually, it's OK if $a_i$ arrives after a few higher-ranking people, as long as there's still at least one job left that isn't filled by a higher-ranking candidate. In other words, it's OK as long as the number of higher-ranking candidates who arrive before $a_i$ is \le k-1$.
