Live data from Hacker News

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

news.ycombinator.com

131–140 of 363 posts

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

#131

I'm a marketer, and have yet to find a way to judge a marketer's competence better than: "Here's this app, here's what it does. How would you increase downloads?" A quick brainstorm session shows you how they approach the situation, what tricks they have in their bag, and what methods they feel confident using (or if they're just BSing). Interestingly enough, 50% of the time people answer "SEO," which is among the wo…

And then you ask them what they mean by SEO, and it gets worse. SEO is one of my favorite buzzphrases, because it causes ignorant marketers to rapidly self-select. (Unless their explanation shows otherwise.)

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

#132
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.

There are tons of variations and few people know them.

For instance ask "What if the showman didn't know which door the car was behind?"

IIRC even if you exclude instances where the showman shows a car, it evens out the odds.

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

#133

Earlier quoted context omitted.

Good question, and one that sometimes comes up when I ask it in interviews. You are tossing the same coin 10 times.

This is a fun question. Can I look at the coin's two sides? If not...I assume you now have to start applying statistical tests (given that a fair coin will only do this once out of 1024 times, what are the chances I've got one of those 999 coins vs the 1/1000 chance that I picked the double headed coin?) or is there some simplifying assumption I'm missing. Anyway--assume I think all that aloud in an interview. What d…

You can only see the result of the flips, you can't examine the coin. Yes, it comes down to estimating the probability of having a biased coin given that you have seen it come up heads ten times in a row.

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

#134
post #11

Working for a web company. Our favourite JS question is, "What happens if you do this?" var func = function func () { // blah };

I teach JS. I use a a stronger one:

    var func = function func(func) {
      var func;
      console.log(typeof func);
    };
    function func(func) {
      console.log("func");
    }
    func("func");

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

#136
post #18

I'm an SE now, but I got my degree in Northwest Semitic Literature and Linguistics: Here's a couple: Are Semitic languages VSO or SVO? What does it mean that Semitic words are triliteral?

Isn't the semitic language a gotcha because of how arabic and hebrew have changed to SVO (while remainder are largely vso?) Or is that the point of asking?

In this case the assumption is that we're talking about ancient languages.

Edit

You're right that it would be (somewhat) impressive if they knew there was a transition.

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

#137

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…

That's a nice filter. (Of course, I'm a former mathematician as well.) Here's how I think of it:

- the prior odds that you picked the double-headed coin are 1/999.

- after seeing ten heads, the posterior odds that you picked the double-headed coin are (2^10)/999 - let's approximate this as 1. (Bayes' theorem usually gets expressed in terms of probabilities, but it's so much simpler in terms of odds.)

- so it's roughly equally likely that you have the double-headed coin or any non-double-headed coin; the probability of flipping an eleventh head is then approximate (1/2)(1) + (1/2)(1/2) = 3/4.

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

#138

Earlier quoted context omitted.

The variable declaration is hoisted to the top, then is assigned a named function expression `func` so that `func.name === 'func'`. Useful for proper error messages and stack traces. Something else I'm missing?

Could you go into more detail about why you would do A) var func = function func() { /* blah */ }; Instead of B) function func() { /* blah */ };

    var func = _.memoize(function private_non_memoized_func() {
      func(); // "light"
      private_non_memoized_func(); // "heavy"
    });

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

#139
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.

Hah. I once asked an intern some random JS question and he used JQuery for everything. So I then asked him what the $ meant. That was a very awkward 5 minutes of silence.

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

#140

Earlier quoted context omitted.

Should I parse it as tossing the same coin 10 times, or choosing from the jar 10 times?

Good question, and one that sometimes comes up when I ask it in interviews. You are tossing the same coin 10 times.

0.753?

A the beginning, there's a 1/1000 chance that you pick a double-headed, and a 999/1000 chance you pick a fair coin.

A fair coin would act the way you've observed 1/1024 times. A double-headed coin would act that way 100% of the time.

(This is where I get fuzzy): Given what you've observed, there is a (1000+1024)/1024 = 0.506 chance that the coin is double-headed. There is a 0.494 chance that it's fair.

A double-headed coin would come up heads next 100% of the time. A fair coin would come up heads 50% of the time. So, 0.506 x 1 + 0.494 x 0.5 = 0.753.

How far off am I?

Post reply on HN