Live data from Hacker News

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

news.ycombinator.com

91–100 of 363 posts

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

#91
post #82
post #78

Earlier quoted context omitted.

Your result is correct but your reasoning is not sound. A & B => C and !B does not imply !C.

Well, I already admitted I'm not a logician: if A & B => C, (!A | !B) => !C looks implicit to me, and while this isn't the first time I've had my nose rubbed in the fact that it's not, I never could understand why not.

That's the same as [ A => B ] and therefore [ !A => !B ]. This can easily be shown to be an invalid inference by instantiating A and B appropriately.

  A = "It's Raining"
  B = "Water is falling from the sky"
The first is clearly true. If it's raining, then water is definitely falling from the sky. The second is clearly false. Just because water is falling from the sky, that does not necessarily mean that it's raining.

You can probably invent your own, somewhat more humorous examples.

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

#92

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

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

#93
post #74

Where I work, we have a 4 question SQL test where we sit you in front of a dummy database, give you 4 printed results, and say "make the queries to produce exactly these results." Very very few people get all of them, but it gives us an idea of where somebody is at in their ability and knowledge. The first is the easiest, and the second one isn't bad. The 3rd and 4th trip up most people though.

I'd be curious to see that test.

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

#94

Earlier quoted context omitted.

The function is able to reference itself, allowing recursion. This used to cause an error in Safari though, am I right?

A function can reference itself without defining the name twice. These both work just fine: var factorial1 = function(n) { return n

Recursive functions like this are more like closures and not pure functions. Aliasing factorial1 and reassigning it will break the recursion [1]. Maybe this is what jbrooksuk was referring to.

[1] https://leanpub.com/javascript-allonge/read#recursive

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

#95
post #37

I have been unable to think of one for Linux system administrators. :-(

I've seen a good one -- actually got asked it in a phone screen I did last year: "How would you recursively delete all files with extension 'mp3' in a given directory tree?" The (simplest) correct answer (I know) is find /path/to/wherever -name "*.mp3" -exec rm -fv {} \; Maybe that's more of a pons asinorum , I suppose, but then isn't a pons asinorum precisely what a fizzbuzz question is meant to be?

Can't we

    cd /path/to/wherever
    rm -rf *.mp3

?

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

#96
post #37

Earlier quoted context omitted.

I've seen a good one -- actually got asked it in a phone screen I did last year: "How would you recursively delete all files with extension 'mp3' in a given directory tree?" The (simplest) correct answer (I know) is find /path/to/wherever -name "*.mp3" -exec rm -fv {} \; Maybe that's more of a pons asinorum , I suppose, but then isn't a pons asinorum precisely what a fizzbuzz question is meant to be?

Can't we cd /path/to/wherever rm -rf *.mp3 ?

You have stumbled squarely into the tripwire implicit in that question; "rm -rf *.mp3" ignores directories whose names don't end in ".mp3", and deletes those whose do.

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

#97

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…

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.

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

#98

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…

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

[deleted]

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

#99
post #28
post #12

Applied math/scientific computing: If hiring someone, I would describe some practical scenarios problems involving the solution of finite-dimensional linear systems, and ask to see how they would suggest solving them in each circumstance (LU, QR, SVD, iterative methods, etc). More discussion oriented than in doing rote recital of algorithm structure, probably. I would do something similar for functional characterizat…

Do you have any example problem to share? I've taken a numerical analysis class and this interview-like questions are appealing.

These are rough guidelines based on current best-practices that I know of, and shouldn't be treated as doctrine obviously. Numerical analysis/linear algebra is actually a pretty fast evolving field as far as applied math goes. Though statistics is a bit less dynamic at the moment, I'd say.

Honestly, after a certain amount of time, I'd expect a new hire would be able to teach me what is state-of-the-art in the field based on new literature.

But the questions I'd have in mind would be couched like this:

Linear system:

    - Is it small, square, and numerically well-conditioned? Use LU - it's pretty fast to write and pretty fast to use in practice.

    - Is it small, but rectangular (ie. overdetermined), or not as well conditioned? QR is a good choice.

    - Is it small, but terribly conditioned, or do you want to do rank revealing, or low-rank approximation while you're at it? Will you be using this matrix to solve many problems (multiple right-hand sides)? SVD would fit the bill

   - Is it large, or sparse, or implicitly-defined (ie. you don't actually have access to the elements of the matrix defining the system - you just have a surrogate function that gives you vectors in its range, or something)? Use an iterative algorithm. Krylov subspace methods (MINRES, GMRES, conjugate gradient, etc) are your friends here.
Pattern matching (more specific in question formulation):

    - If you wanted to determine the "strength" of a waveform (in a finite uniform sampling of data) that is re-occurring in a fairly regular way (like arterial pulse in an array of data taken from an oximeter), what type of transformation would you use, and how would you use the resulting information given in transform domain?

   - What if you wanted to determine the strength of a waveform that is short lived/impulse in nature, but re-occurs without any known periodicities (eg. eye blinks artifacts in a sample of EEG data)

   - How would your answers to the above questions change if there are n separate channels of data collected simultaneously (ie. sampled in different locations), which may be analyzed together?
Statistical analysis (might seem vague, I'd be more interested in good discussion with a candidate here than in actual whiteboard writing):

    - What does statistical significance mean, in the context of decision making? Is it a property of the test you perform, or is it a property of your data? (sort of a trick question, this basically rehashes the Fisher vs. Neyman & Pearson debates of the 20th century stats community)

   - Some cod problems of when to use z, t, f tests. Basically, you use them when your situation matches the appropriate inference models (two normally-distributed sample comparison of means with identical variances? t test.)

   - How do you construct an optimal test from scratch, if one doesn't already exist for your particular situation? (basically, if minimize type II error with fixed type I makes you comfortable for your problem, can you do use the Neyman-Pearson lemma to do likelihood ratio construction correctly)

   - What does a p-value actually mean? What if you instead wanted to have actual probabilities for your hypotheses, or you had apriori information that you wanted to use? (Bayesian inference is the winner here)

   - Probably something from point estimation: least squares, minimax criterion, Bayesian MAP estimates, general model fitting, those sort of thing. Brings it all back around to numerical (where I'm most comfortable). Like how applying statistical ridge regression is just knowing how to code up Tikhonov regularization, when you get down to implementation.

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

#100
post #40

On/off producer + audio engineer. A good discriminator might be "it's squaring out; what do you do?". A good answer would lead to an argument about the compression war.

10-20db cut in the lower freqs?

(Depends on what the source of the track is.)

Post reply on HN