two interview questions

  • Thread starter Thread starter yoyota
  • Start date Start date
Joined
1/21/12
Messages
2
Points
11
1. You have a biased coin in which the probability of getting a head is 51﹪ . Create an event out of this coin which has a probability of 25﹪

2. There is a calculator in which all digits(0-9) and the basic arithmetic operators(+,-,*,/) are disabled. However other scientific functions are operational like exp, log, sin, cos, arctan, etc. The calculator currently displays a 0. Convert this first to 2 and then to 3 .
 
1. 0.51 x 0.49 = .2499 (heads then tails or tails then heads)

2. I was able to get to 1/2 and 1/3 assuming the square() function is available. Not sure about this one....
 
.2499 != .25
Without putting too much thought into it, I would just solve the binomial distribution with either p=0.51 or p=.49 for some number of trials and successes that has "exactly" (if you can get there with an integer) 25% probability.
 
2. cos, e^x, x^2, ln(x) to get to 2. Couldn't get to 3 yet..

edit: x^2, x!, 10^x, sqrt(x), sqrt(x), sqrt(x), log(x) to get to 3.
 
For (2):

0 -> 10^x = 1 -> e^x = 2.71828 -> int -> 2 -> sinh -> 3.62 -> int -> 3

A shorter path should be available, this is off the cuff.
 
I wouldn't expect an interviewer to accept floor/int and sinh. I was trying to use the standard functions available on most calculators (trig, inverse trig, exp, ln, sqrt and square).
 
For #1:

If you can do conditional, you can do P(THTH | you get a T and H in the 1st 2 and 2nd 2 flips).

If you can't do conditional, you can just vary it by flipping the coin twice per set. What is the probability of getting TH the 1st 2 times you have non-matching flips in a set?
 
Coin flips are independent, so conditioning the probabilities will not change them. P(A|B) = P(A & B) / P(B), but P(A & B) = P(A) * P(B) due to independence, so P(A|B) = P(A).

Although it seems like you are trying to use future events as a condition, which doesn't work at all. I think you're trying to describe P((TH OR HT) & (TH OR HT)), which still wouldn't be 25%.
 
Coin flips are independent, so conditioning the probabilities will not change them. P(A|B) = P(A & B) / P(B), but P(A & B) = P(A) * P(B) due to independence, so P(A|B) = P(A).

Although it seems like you are trying to use future events as a condition, which doesn't work at all. I think you're trying to describe P((TH OR HT) & (TH OR HT)), which still wouldn't be 25%.

In my solution, A is a subset of B so P(A & B) = P(A).

THTH, THHT, HTTH, and HTHT all occur with the same probability. Pick one of them, and you're picking 1 out of 4. The non-conditional probability works the same way but gets rid of the condition.
 
2. There is a calculator in which all digits(0-9) and the basic arithmetic operators(+,-,*,/) are disabled. However other scientific functions are operational like exp, log, sin, cos, arctan, etc. The calculator currently displays a 0. Convert this first to 2 and then to 3 .

How about this one, which would use Euler's Identity:

(e^(πi))(e^(πi)) = 1

now x = 1

ln((e^x)(e^x)) = 2

now x = 2

ln((e^x)(e^((e^(πi))(e^(πi))))) = 3
 
How about this one, which would use Euler's Identity:

(e^(πi))(e^(πi)) = 1

now x = 1

ln((e^x)(e^x)) = 2

now x = 2

ln((e^x)(e^((e^(πi))(e^(πi))))) = 3

I suppose we could simplify this a considerable amount:

ln(e) = 1

ln((e)(e)) = 2

ln((e)(e)(e)) = 3
 
Back
Top