Live data from Hacker News

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

news.ycombinator.com

251–260 of 363 posts

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

#251

Earlier quoted context omitted.

find path -iname "*.mp3" -print0 | xargs -0 rm -fv

I'd give half marks for this, because it optimizes (meaninglessly) for processes, at the risk of ending up with "rm: Too many arguments" in a directory tree containing a sufficiently large number of MP3 files.

xargs knows the maximum command line length, and will invoke the program more than once if necessary. One of the points of xargs is to break up invocations of a program into chunks of arguments that fit in one maximum length command line.

  xargs reads items
  from  the  standard  input, delimited by blanks (which can be protected
  with double or single quotes or a backslash) or newlines, and  executes
  the  command (default is /bin/echo) one or more times with any initial-
  arguments followed by items read from standard input.

  --max-chars=max-chars
  -s max-chars
         Use at most max-chars characters per command line, including the
         command  and  initial-arguments and the terminating nulls at the
         ends of the argument strings.  The largest allowed value is sys‐
         tem-dependent,  and  is  calculated as the argument length limit
         for exec, less the size of your environment, less 2048 bytes  of
         headroom.   If this value is more than 128KiB, 128Kib is used as
         the default value; otherwise, the default value is the  maximum.
         1KiB is 1024 bytes.

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

#252
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,…

More sysadmin / troubleshooter focused person here, and I love this sort of question. It also brings out people who will throw out things like "do a network capture". Then you either get the "well, send it to the network team!" answer or the (much more desirable) "look for X, Y, Z, or something weird in N...".

Are you saying "do a network capture" isn't desirable? It's not the first thing I would do, but I wouldn't get to Z before taking one.

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

#253

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.

Yeah. ITT all sorts of vocations I'm not even remotely qualified for but want to learn anyway.

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

#254
post #198

Earlier quoted context omitted.

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.

Did you miss the bit in the OP where one of the coins has heads on both sides? The coin may or may not be biased, and the results of flipping it give you information about whether or not it is biased.

Explaining the bit you quoted: if you had perfect knowledge of the wind conditions, how hard the person flipped the coin, and so on, you would know precisely which side it would land on. That fact is determined. It's just because you are missing information that there's 50% probability of heads (for an unbiased coin). The probability comes out of your imperfect knowledge, and changes depending on your knowledge: for example, if you have some reason to believe the coin is biased, then you no longer think it's going to land on heads 50% of the time. Since one of the coins is biased, getting a long string of heads is reason to think that the coin they drew and are flipping is the biased coin. This information affects the probability you assign to the coin coming up heads.

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

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

Yeah, because it's in every easy undergrad stats textbook.

The problem with asking trick questions in an interview is that, although they may make the interviewer look smart, they are orthogonal to the ability to do the job. It's better to ask how to solve a current, pressing problem and see what questions the candidate asks. It's the questions that elucidate thinking style. Also, it's crowdsourcing and you can attribute or blame the candidate as the case maybe.

The other part is getting along, so if an interview doesn't include something fun, it's all boring formality that doesn't allow anyone to get to know each other. Take them to a normal lunch if possible, because much more is learned by how people eat.

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

#256
post #240

Earlier quoted context omitted.

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?

Okay yeah, I'm stupid for pressing on while crntaylor already gave his answer. I'll shut up now.

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

#257
Embedded systems programming (firmware).

Explain the difference between interrupt context and thread context. (With Embedded Linux, also throw in kernel space and user space.)

FizzBuzz coding would be showing how to safely share information between interrupt and thread context. Would be listening for message queues, locking, interrupt enable/disable.

Also, if you have done a lot of programming, the term "race condition" should make the interviewee blanch in terror.

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

#258
post #26

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…

There's a difference between marketing and product design. A marketer should know how to get qualified leads for lowest cost to your app, and then it's your product manager who should worry about making the best impression with new users.

> There's a difference between marketing and product design. A marketer should know how to get qualified leads for lowest cost to your app, and then it's your product manager who should worry about making the best impression with new users.

In my own experience the marketer's primary job is to identify how and why your end-users might use your product, i.e. understand who these qualified leads are to begin with.

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

#259

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 think the fact that all solutions posted so far are broken and even repeat bugs I already pointed out validates this as a useful FizzBuzz test :-)

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

#260

Earlier quoted context omitted.

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

What if you picked a random coin from the jar, then you looked at it and saw that both sides are heads. Is the probability that this is the coin with both sides heads still 0.001? No, the probability that this is the coin with double heads is 100%.

Now if you pick a random coin from the jar, and you randomly observe one of the sides of the coin 1 billion times and every time you see heads, is the probability that this is the coin with both sides heads still 0.001? No, the probability that this is the coin with double heads is very close to 100%.

Now if you pick a random coin from the jar, and you flip the coin 1 billion times, and every time it comes up heads, is the probability that this is the coin with both sides heads still 0.001? No, the probability that this is the coin with double heads is very close to 100%.

How about if you flipped it 10 times and it came up heads 10 times? Turns out the probability that it is the coin with double heads is about 51%.

Probability quantifies the degree of uncertainty YOU have about the world. This can change even when the world doesn't change, namely when you observe something about the world.

Post reply on HN