The is given that A and B each select one number at random from the distinct number 1,2,3,...,n then the probability that the number selected by A is less than selected by B, ‌
nC2
n×n
‌‌=‌
n(n−1)
2(n×n)
‌‌=‌
1009
2019
Thus, ‌
n−1
2n
‌‌=‌
1009
2019
n‌‌=2019
Now number of ways selecting a number from 1,2,3,...,2019 by B is the number immediately next to the number selected by A is 2018. So the required probability is,