Live data from Hacker News

Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

news.ycombinator.com

231–240 of 363 posts

Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

#231

Earlier quoted context omitted.

I wouldn't use the data. The coin hasn't changed since I picked it out of the jar. If I flip it 1, 10, or 10e100 times, the coin would still be the same coin. So figure the p(heads) for the coin and ignore the previous history. Overthinking it is why this makes a good FizzBuzz problem.

An example that should show this approach is wrong: Suppose that the jar contains 500 double-head coins and 500 double-tail coins. You pull a coin from the jar, flip it 10 times, and get 10 heads. What is the probability it will come up heads next time?

That seems like a completely different problem to me, since all randomness is out of the system the moment you see the first flip.

Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

#232
post #59

Earlier quoted context omitted.

The Monty Hall problem (or a subtle variant) is also great one to watch people work through. It's a chance to see if people can thing about probability in a sort of asymptotic way. Basically (if they get stuck), ask them how they would choose if there were actually a 100 doors, but the same rules apply. Obviously, everyone switches. What about 99? 98? ... turns out, 3 doors is the smallest number where the strategy i…

The problem with asking Monty Hall in an interview is that ~75% of candidates already know the answer.

And if they didn't, they would probably get it wrong even if they're experienced statisticians.

Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

#233
post #176

Earlier quoted context omitted.

Ask yourself a question: can you use the data (the 10 coin tosses) to update the probability of the current coin being two-headed?

I wouldn't use the data. The coin hasn't changed since I picked it out of the jar. If I flip it 1, 10, or 10e100 times, the coin would still be the same coin. So figure the p(heads) for the coin and ignore the previous history. Overthinking it is why this makes a good FizzBuzz problem.

You are getting downvotes because you didn't follow Bayesian reasoning, but there is some justification for your instincts here http://www.stat.columbia.edu/~gelman/research/unpublished/ph...

Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

#234

Earlier quoted context omitted.

I would make a couple of assumptions: - price could be 0.0 for a book - Total sales means the sum and not count - Date format will be yyyymmdd (if not, assume that we converted in Oracle or Sybase) SELECT a.name, SUM(s.price) FROM authors a INNER JOIN books b ON (a.id=b.author_id) LEFT OUTER JOIN sales s ON (b.id = s.book_id) GROUP BY a.name HAVING (s.date >= '20131101' AND s.date

Instead of the Left Outer Join, couldn't you also make it an Inner Join to S.BOOK_ID? The question, if I read it correctly, only requires you to return sales in Nov 2013. If there is no data for a book_id, you want to exclude it from your returned data, no?

I would imagine it is up to interpretation. It would probably be a good thing to ask the interviewer about to show that you are thinking about edge cases.

If it were me, I'd prefer to see those that made no sales based on the question. I guess if I didn't want to see them, I would ask for "where sales are greater than $0.00".

Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

#235
post #219
post #205

I just saw Wolf of Wall Street this weekend. Has anyone in sales been asked "sell me this pen" in an interview?

I'm good at sales. But I would really bristle at being given a question like that (and luckily I don't have to interview so this will not happen). For one think selling takes preparation, knowledge of the product and strategy. It also takes experience (for a particular product and buyer and situation). So in my mind I don't see what asking a question like that will prove other than that you can ad lib or bs in a way…

This explanation actually properly answers the question, in my mind. :-)

Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

#236

Earlier quoted context omitted.

But that's not what the OP/Interviewer wants to know. All he asked was this: "Given that you see 10 heads, what is the probability that the next toss of that coin is also a head ?" He didn't ask you to identify the coin. He just wants to know if the flip is going to be heads.

The probability of which coin you have affects the probability of the next toss coming up heads, so having this knowledge is implicit in determining the solution.

That probability was determined the moment you picked the coin out of the jar.

It makes no difference what you do to it after the pick. Hold it in your hand for a day, flip it 10 times, sit on it, whatever - the end result is that p(heads) for that particular coin has not changed. p(heads) will be either 0.5 for a real coin or 1.0 for the rigged one.

The probability then comes down to what coin you picked at the start of the trial. There's a 0.999 chance you have a real one, and 0.001 chance that you have the rigged one.

Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

#237
post #123
post #73

Imaging science. If I were hiring another imaging scientist: Write your own Fourier Transform. [If your FizzBuzz questions involve actually writing/coding the FizzBuzz, I'd not request actually writing it...]

I wonder how effective of a test this would be. Are the algorithmic & implementation details of the Fourier transform that important to imaging science? I would imagine that explaining the properties of the FT, it's connection to imaging modalities, etc would be far more relevant than actually coding a DFT. How would you weight a naive implementation of the DFT vs the FFT?

>How would you weight a naive implementation of the DFT vs the FFT?

Luckily he didn't specify the dimensional requirements, so we can get away with f^[0] = f[0].

Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

#238
post #198

Earlier quoted context omitted.

"If you flipped 10 heads in a row the probability of the coin you have being the double heads coin increases dramatically..." I disagree. The coin is the coin. It didn't magically transport itself or change state after flipping it 10, 100, or a billion times. Lets change the puzzle to the simplest state: you pull a coin from the 1000-coin jar and flip it just once. What's the probability of heads? This is why roulett…

The coin is the coin, but your information about the coin has changed. Probability is a fact about you, not a fact about the coin. Here is perhaps a more visceral example: On any given day, your car has a 10% chance of having blown a wheel the previous night. If it has blown a wheel, every bump will feel jarring. If it hasn't blown a wheel, any given bump will feel jarring with 10% probability. You drive over a hundr…

Probability is a fact about you, not a fact about the coin.

Huh? It's a coin. You flip it. It has no knowledge of the past and no idea about the future. It lands and it's either heads 50% of the time and tails 50% of the time. It's all about the coin and nothing about what you've observed in the last N trials.

That's the simple logic that the OP is trying to see if you understand.

Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

#239

I was a mathematician, and now work in finance (systematic trading). I've found a reasonable negative filter is A jar has 1000 coins, of which 999 are fair and 1 is double headed. Pick a coin at random, and toss it 10 times. Given that you see 10 heads, what is the probability that the next toss of that coin is also a head? That tests their ability to turn a problem into mathematics, and some very basic conditional p…

My wife and I have discussed this, and get a different answer to a few of the solutions we then googled for. I think it is as simple as: http://pastebin.com/gg5DTySG

This is the simplest explanation, thank you.

Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?

#240
post #187

Earlier quoted context omitted.

The probability of heads is 0.999*0.5 + 0.001*1 = 0.5005 The important thing is that as you observe heads from the coin, you learn something about the coin. As you observe more heads it is less likely to be a fair coin and more likely to be the coin with double heads. This doesn't change anything about the coin, but it changes something about what you know about the coin. See here for the correct answer: https://news…

Since the question simply asked what p(heads) was on the next flip, it seems our answers match. Thanks!

Our answers to your question may match, but I very much doubt that our answers on the original question match. The crux is that your question is not equivalent to the original question. If you are interested in learning why that is I can explain it further, but it doesn't look like you are?
Post reply on HN