Live data from Hacker News

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

news.ycombinator.com

181–190 of 363 posts

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

#181
post #169

Earlier quoted context omitted.

Isn't the gotcha of this test the fact that the history of previous coin flips has no effect on the next flip , given a fair coin? The OP is only asking what the outcome of the NEXT flip is, not the probability of flipping 11 heads in a row. Or did I read this wrong?

You didn't read it wrong, but you probably did fail the test ;-) There is no gotcha in the question, it's just a math problem that you either do or do not know how to solve. This isn't really about intelligence as much as it is about whether you have taken a course on probability. If you flipped 10 heads in a row the probability of the coin you have being the double heads coin increases dramatically, so you have to t…

"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 roulette and baccarat tables in Vegas have those signs showing previous outcomes. It's meant to mess with your head. Previous history has no effect on future outcomes. A fair coin could come up heads a billion times in a row as well. The next flip will still be 0.5.

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

#182

Earlier quoted context omitted.

Sure. The slick answer is The chance of picking the biased coin is 1/1000. The chance of seeing 10 heads from a fair coin is (1/2)^10 = 1/1024. These are nearly equal, so given that you've seen 10 heads, there is a 50/50 chance of having a biased coin. So the probability the next flip shows a head is P(H) = P(biased) * P(H|biased) + P(fair) * P(H|fair) = 0.75 The long answer - Yo want to figure out P(biased | 10H). U…

Isn't the gotcha of this test the fact that the history of previous coin flips has no effect on the next flip , given a fair coin? The OP is only asking what the outcome of the NEXT flip is, not the probability of flipping 11 heads in a row. Or did I read this wrong?

More or less

"The OP is only asking what the outcome of the NEXT flip is, not the probability of flipping 11 heads in a row"

This is correct, however the history of flips gives us an information on the type of coin we have in our hands

Would be interesting to see the probabilities if we had gotten 11 heads, 15 heads or 20 heads in a row.

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

#183

I'm a mathematician, and sometimes I need to assess the level at which I'll pitch an explanation. Although I don't do this in a setting where it's possible to set a test, as such, I do ask this question: An equivalence relation is reflexive, symmetric, and transitive. If E is an equivalence relation, and we know E(x,y) but we know !E(y,z), what do we know about E(x,z), and why? It seems a great filter for people who…

I would definitely reason intuitively to solve this question, rather than formally. When I see E(x,y) I paint a picture in my head putting x and y in the same equivalence class:

    =======
    | x y |
    =======
When I see !E(y,z) I put a picture in my head where z is outside of the equivalence class of y (and x):

    =======    =====
    | x y |    | z |
    =======    =====
Hence we can conclude that !E(x,z). So while this is a nice question, I don't think it achieves your goal of testing formal as opposed to intuitive reasoning.

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

#185
post #76

This is an off-topic answer, but I see no reason why this thread shouldn't be generalized to FizzBuzz equivalents in other careers (in fact, it might be interesting to do so). Our electrical engineering FizzBuzz is an introductory, Freshman-level voltage drop problem, found within the first chapter of any Circuit Analysis textbook: R1 (N) R2 [VDD]-^^^^--*--^^^^----| Given VDD, R1, and R2, compute the voltage at node…

"What's disappointing is that a large number of senior undergraduate students are unable to solve this problem "

Ouch! :)

I'd say it's even simpler than a regular FizzBuzz.

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

#186
post #175

Earlier quoted context omitted.

One issue I have with Monty Hall problem as an interview question is that the problem statement is too subtle, with several hidden assumptions. Interviewers often end up posing a different puzzle without realizing just by using a slightly different language to pose it.

That's true, the rules really do have to be laid out in plain language to be a fair question.

Not only that, the problem statement has to be written down somewhere. I have gotten burnt in the past with problem statements changing along the way.

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

#187
post #169

Earlier quoted context omitted.

You didn't read it wrong, but you probably did fail the test ;-) There is no gotcha in the question, it's just a math problem that you either do or do not know how to solve. This isn't really about intelligence as much as it is about whether you have taken a course on probability. If you flipped 10 heads in a row the probability of the coin you have being the double heads coin increases dramatically, so you have to t…

"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 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.ycombinator.com/item?id=7000523

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

#188
post #88
post #55

I build web sites. I would ask that the person complete a series of tasks that involved using Javascript to do a bit a typical DOM manipulations and CSS changes, especially using transitions and whatnot... ...without jQuery.

Just curious, why do you not allow the interviewee to use jQuery? Do you expect the candidate to know JavaScript's DOM-level APIs without having to look them up?

Hang out on forums, #javascript, etc some time and see how many people have problems because their understanding of the DOM begins and ends with the jQuery API. I see it all the time. I've seen big-name sites bug out or slow to a crawl because some dev wasn't thinking about what was going on behind their $()'s.

The DOM API isn't very large/complicated, and it shouldn't be hard to MOSTLY memorize it. It isn't a "gotcha" question though, a good interviewer is not gonna ding the heck out of you if your forget bits of it (most web devs do spend most of their time with jQuery, YUI, etc after all) - it's about whether you understand what's going on behind the scenes.

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

#189

This thread makes me feel like a worthless POS but at the same times motivates me to finish learning so many pending topics properly. Nothing's better than an actual test.

A worthless POS would lack to motivation to finish learning...

I'm very low on motivation, but my derivative, even if small, is positive yes.

But I got a college (a good public one) diploma, yet reading this I feel anything above Linux devops and FizzBuzz would be far from my reach, that's what I meant by worthless P...

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

#190
post #176

Earlier quoted context omitted.

That's what I got. There's a .999 chance you have a fair coin and a .001 chance you have the rigged coin. (0.999 * 0.5) + (0.001 * 1) = 0.5005. Seems too simple, but a coin is a coin, right?

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.

Post reply on HN