Live data from Hacker News

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

news.ycombinator.com

211–220 of 363 posts

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

#211

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 roughl…

For the interested, some links to Bayes' theorem: http://en.wikipedia.org/wiki/Bayes'_theorem

http://yudkowsky.net/rational/bayes

Useful if you want to know (or need a good way to explain) what a posterior probability is and how it's different from a prior probability

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

#212
post #187

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 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!

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

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

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?

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

#214

I'm a software developer, but the code I work does a lot of DB access. I always ask a "two joins and an aggregate question." Given three tables: authors books sales ---------- ---------- ---------- id id id name author_id book_id title date price find the total sales by author in November 2013. The result set should have two columns: author's name and their total sales.

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?

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

#215

I hesitate to say this, because it might be misconstrued. However, some people seem not to know it, so it might be of value regardless ... Once an item has more than 40 comments, if the number of comments is more than the number of points, there is a ranking penalty applied. This is because it's a good proxy fr an item being a flame-war. So if you're interested in seeing more answers to this question, or carrying on…

Is it known whether the flame war detector applies any significance to particular words appearing in the comments to determine if there is actually any war going on just because there are not enough item up votes?

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

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

That's not really fizzbuzz, that's more the equivalent of asking a C programmer to write fizzbuzz in assembly (perhaps that's a little too strong a comparison, but you get the idea).

Fizzbuzz for websites would be to have someone code two paragraphs side by side with a header and footer in CSS.

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

#217
post #56

Earlier quoted context omitted.

he didn't mean literally like a class, it was an analogy. x is to y as z is to ...

Yes but an analogy needs to have some reasonable connection to the thing you are comparing it to for the analogy to make sense.

[deleted]

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

#218
post #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…

You know about equivalence classes and know to apply them. You can reason about partitions rather than needing to drop down the the level of logical implications (higher level abstractions for the win). If you remove the "think" part and become a little bit more assertive, your intuition becomes a proof.

You pass.

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

#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 that doesn't matter.

Selling also takes interpreting cues (verbal and visual) from the potential buyer. With those cues you change strategy on the spot and try to hit the right hot buttons. [1]

In a hypothetical situation it's unlikely that those cues would be valid because the person you are trying to sell knows it's not a real situation.

[1] As an example the strategy that you would use to sell a car to a father for his daughter is not the same as to a middle aged woman. And by listening to the father you could tell what points are resonating and try to reinforce those points more if appropriate.

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

#220
post #70

For sysadmin/ops jobs, I want to see debugging ability in addition to programming skill. I usually ask about HTTP and DNS (for web-focused) or Kerberos/AD logins (for user focused). There are a lot of moving parts to either of these, so a question like: "You type a web address into a browser, it doesn't load" can turn into questions about the DNS resolver process, system and network config, split horizon, time setup,…

> "You type a web address into a browser, it doesn't load"

1) Check your internet connection. 2) Check if the website is broadcasting (assuming you control it).

99% of all instances of this issue solved right there. :-)

Post reply on HN