GeeksforGeeks » Interview Questions
Infosys Interview Question for Software Engineer/Developer (Fresher) about Puzzle
(5 posts)-
Persons A and B. Person A picks a random no. from 1 to 1000.Then person B picks a random no. from 1 to 1000. What is the probability of B getting no. greater then what A has picked.
-
Say A picks 1 with probability of 1/1000 so now B has 999 numbers to choose from that are greater than 1.
So the probability comes out to be
1/1000*1/999+ 1/1000*1/998+ 1/1000*1/997 .... 1/1000*1(where A chooses 999).
i.e
1/1000( 1/999 + 1/998 + 1/997+...1) -
I think @ajaym has missed some point
Say A picks 1 with probability of 1/1000 so now B has 999 numbers to choose from that are greater than 1.So the probability comes out to be (1/1000 * 1 )
Say A picks 2 with probability of 1/1000 so now B has 999 numbers to choose from that are greater than 1.So the probability comes out to be (1/1000 * 998/999 )
similarly
1/1000*1/999+ 1/1000*2/999+ 1/1000*3/999 .... 1/1000*999/999
i.e
=(1/1000)*( 1+2+3+ ... +999) /999
=(1/1000)*(999*1000*(1/2))/999
=1/2
=============We can think this problem in other way also , directly give probability to 1/2.
:)
-
its
999/2000; -
a very logical way to solve it easily:
prob of B not getting same number as A : (1-(1/1000))=999/1000
As a simple symmetry rule
prob of getting smaller number = prob getting greater number
Therefore probability of getting larger number=999/2000
-----------------------
one more way to see this problem as ways of choosing 2 numbers that will be 1000 C 2
and total ways will be 1000*1000
so prob =(1000 c 2)/(1000^2)
Reply
You must log in to post.