
Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent? - ColinWright
I was recently chatting with friends and the question came up:
    When hiring a programmer, FizzBuzz is sometimes
    (and controversially) used as an initial filter.
    What&#x27;s an equivalent filter for mathematicians?<p>I know that HN is filled with people who have specializations outside of programming, so I ask:<p><pre><code>    What is your specialization, and
    what is your &quot;FizzBuzz&quot; equivalent?
</code></pre>
<i>Added in edit: Fascinating answers - thank you. I&#x27;d love to respond to many of them but that would probably trip the HN flame-war detector, penalise the item, and I&#x27;d get no more replies! If you want a reply, email me, or make sure your email is in your profile. And thanks again to all.</i>
======
barik
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 N.

This works surprisingly well as a negative hiring filter. It's not intended to
be a trick question at all: it can be solved with Ohm's Law:

    
    
      I = VDD / (R1 + R2)
      Vn = VDD - R1 * I
    

or faster and more intuitively using voltage dividers:

    
    
      Vn = VDD * R2 / (R1 + R2).
    

What's disappointing is that a large number of senior undergraduate students
are unable to solve this problem -- which I think makes it a good EE
equivalent of the FizzBuzz problem.

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

...Wat? That's like, one of the easiest questions you could ever be asked. As
a senior undergrad in his final semester for EE (Computer Engineering
specialization), could you give me an idea of some of the more difficult
questions you would ask?

~~~
n00bhere
I was once given a boolean function, asked to implement it using logic gates.
And then asked to optimize it based on a few criteria (for example: GNDs and
VDDs cost a lot, reduce the gates, etc.)

The most annoying thing was, I was not expecting any gates related question so
my optimizations were very... adhoc.

------
ColinWright
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 the discussion, it's worth making sure you up-vote the item to try to avoid
tripping the flame-war detector.

Of course, it may already be too late ...

~~~
larrys
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?

~~~
ColinWright
To the best of my knowledge it's purely depended on number of comments and
number of points. There was a submission some time ago talking about all the
factors involved in getting to, or not getting to, the front page.

I'll see if I can find it.

------
crntaylor
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 probability. Another common question (that I don't use
myself) is to ask what happens to bond prices if interest rates go up.

~~~
madcaptenor
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.

~~~
phamilton
Why is it 1/999? Shouldn't it be 1/1000 since there are 1000 total coins?

~~~
gjm11
Odds, not probability. Probability p means odds of p:(1-p) or, if you prefer
writing it as a fraction, p/(1-p).

(Note 1. The odds of a thing are the ratio Pr(thing) : Pr(not thing). You can
generalize this to any mutually exclusive and exhaustive set of things: the
odds are the ratio of the probabilities. The fact that there may therefore be
more than 2 such things is the reason why I prefer not to turn odds into
fractions as above.)

(Note 2. Bayes' theorem is, as others have mentioned, much nicer when you work
with odds rather than probabilities for your prior and posterior
probabilities. If you're comfortable with logarithms, it's nicer still when
you work with logarithms of odds. Now you're just adding the vector of log-
likelihoods to the prior odds vector to get the posterior odds vector. Which
is how I think of the question above, at least if I'm allowed to be sloppy and
imprecise. You start with almost exactly 10 bits of prior prejudice for "fair"
over "two-headed", then you get exactly 10 bits of evidence for "two-headed"
over "fair", at which point those cancel out almost exactly so you should
assign almost equal probabilities to those two possibilities.)

~~~
phamilton
That makes sense. I've never dealt with odds as a fraction before.

------
ColinWright
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 can think and reason formally, as
opposed to using intuition based on their understanding of the words.

 _Edited in response to lmm 's perfectly reasonable question. In context I
would see if they just assumed they knew what I meant, or asked for
clarification. If they assumed they knew what I meant, it would be interesting
to see what interpretation they used. This is like FizzBuzz - it shouldn't
stop with the first draft of the code - it's an opening for discussion._

~~~
jules
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.

~~~
robrenaud
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.

------
austenallred
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
worst answers you could possibly give. The best answers often involve the
person playing with the app and figuring out something you could actually
build into the app itself.

~~~
snorkel
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.

~~~
atroyn
This is really a false dichotomy. Many apps can market themselves by 'baking
in' sharing, and I don't mean just a 'tweet/like/pin' button on every other
page.

These two functions are not separate.

------
er35826
I'm an electrical engineer who has pared my skill list down to
'troubleshooting.' For my equivalent of a fizzbuzz, the exercise is to present
someone with a potential failure (the light in the room is off) and ask them
how they'd go about investigating the problem.

I like to see all kinds of answers, but particularly more theories are better,
especially when justified at least loosely. Things like "change the light
bulb", "flick the switch", and "check the circuit breakers" are evidence that
they have the right mind for breaking a situation out into many different
causes.

edit: I absolutely loathe 'out of the box' as a meme, but I love hearing
responses like "is anything else in the room turned on?" as it shows a
simpler, more direct way of assessment.

~~~
Piskvorrr
I have misread the last quote as "is anyone else in the room turned on" and
wondered whether that's not a bit far out of the box ;)

~~~
aaronem
That's not a question I've ever had cause to ask on either side of an
interview, to say the least.

------
ecopoesis
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.

~~~
codegeek
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 <= '20131130')

~~~
hdennis
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?

~~~
seanalex
I would imagine it is up to interpretation. It would probably be a good thing
to ask the interviewer about to show that you are thinking about edge cases.

If it were me, I'd prefer to see those that made no sales based on the
question. I guess if I didn't want to see them, I would ask for "where sales
are greater than $0.00".

------
aegiso
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.

~~~
golergka
As a producer and non-native speaker, do you mean digital clipping?

------
jseliger
I do grant writing for nonprofit and public agencies. [1] I usually ask for a
couple of major commas rules. Sometimes for semi-colon rules or for a
description of passive voice. Chances are good that anyone who is zero for
three isn't very good.

A lot of writers and would-be writers also have blogs; it only takes one to
three paragraphs to figure out who can sling a coherent sentence and who
can't.

Like FizzBuzz, being able to sling a coherent sentence doesn't mean that one
can write a coherent 50-page document, but those who can't write a coherent
sentence can't write a coherent 50-page document.

[1] Try [http://blog.seliger.com](http://blog.seliger.com) if you're curious.

~~~
gjm11
How well does the ability to write well correlate with the ability to
articulate _rules_ for writing well?

I'd have thought there are a lot of people who can write any quantity of text
with impeccably placed commas (and semicolons, when the required tone permits
them), but would freeze and stutter and gabble if asked for "a couple of major
comma rules".

I'd put myself among their number, if only because it's not clear to me what
sort of thing you mean by "comma rules". Descriptions of some situations where
it is appropriate to use commas? "Commas are commonly used to separate items
in a list when there are more than two such items" or "commas may be used,
like this, to surround interpolations -- but for all but the shortest such
interpolations you should consider using parentheses or dashes, or
restructuring the sentence"? Descriptions of situations where it's
_inappropriate_ to use commas? "If you have two things that can function as
separate sentences, don't separate them only with a comma; use a full stop or,
in some contexts, a semicolon"? Or higher-level fuzzier principles? "Stops of
all kind are placed to correspond roughly with pauses in speech and boundaries
of grammatical units. The comma is the 'smallest' of stops, and is generally
not used where the pause would be long or where the break in grammatical
structure is great." Or what?

(I suspect a cultural difference at work here: I think formal analysis of
grammar and punctuation may be a bigger deal in the US than it is in the UK.)

~~~
jseliger
_How well does the ability to write well correlate with the ability to
articulate rules for writing well?_

The short answer is "pretty well." Usually I ask specifically for major comma
rules, which I'd tend to define as:

* Connecting independent clauses with a conjunction * As part of a list * To offset a word or phase at the start of a sentence. * Like parentheses (or, in the lingo, an appositive phrase).

If they say, "I have no idea," that's a very bad sign; if they ask questions
like yours, that's a good sign.

A fun, short book called _Write Right!_ by Jan Venolia is worth reading if
you're interested.

~~~
drcode
Known the rules is necessary but not sufficient for an A+ writer.

~~~
gjm11
It's arguable (though I'm not sure it's actually _true_ ) that being able to
write perfectly, and consistently, correctly is necessary for "an A+ writer".

But that is not the same thing as "knowing the rules". A writer may be able to
write perfectly correctly without being able to enunciate any _rules_
accurately at all.

Perhaps you play one or more sports. Could you write down accurate rules
telling you how to hold and move a tennis racquet, or exactly how to flex the
relevant joints when kicking a soccer ball? Of course writing is more
deliberative than tennis or soccer, but a good writer isn't thinking about
grammar and punctuation much more than a good sports player is thinking about
joint angles and muscle groups.

Also, of course, there isn't universal agreement about what is and isn't
correct, nor about what the best set of rules is for describing what's
correct. For instance, if you compare the famous "Comprehensive Grammar of the
English Language" by Quirk and Greenbaum, and the more recent "Cambridge
Grammar of the English Language" by Huddleston and Pullum, you'll find that
their analyses are sometimes very different. Totally different rules, even
though they're describing substantially the same language.

------
martingoodson
For a data scientist I ask "what's a p-value?" Both Junior and senior
candidates often get this wrong. The only difference is that senior people
bristle at such a simple question before also getting it wrong.

~~~
dmd
Ok, now I'm confused, because I was under the impression that this is the
first thing I ever learned in statistics - that a p value is how likely it is
that a value created by chance would have been as extreme as the one the
experiment gave. Is this wrong?

~~~
trthatcher
You have the right idea.

You're assuming an underlying model for the data. You have a test statistic(
that estimates a model parameter) and you have a hypothesis regarding a
parameter. The p-value is the probability that you get a test statistic more
extreme than the one observed _assuming_ that your hypothesis is true.

Ex. You have a sample of 1000 men's heights. You compute the sample average
height as 5'9 and a sample standard deviation of 3 inches.

(Unlikely) hypothesis: the average height is 4 feet. Your p-value is the
probability of getting an sample average more extreme than 5'9 given that your
4 ft height hypothesis is true. Given that the sample standard deviation is 3
inches and 5'9 is 7 standard deviations from 4ft... the p-value is going to be
small, so you'll reject that.

Note: I'm leaving out details and assumptions

~~~
dmd
Yeah, that's what I was taught. So what are people answering instead?

~~~
tel
People can be easily lead to misinterpret p-values even if they can define
them. Most often people assume that p values indicate something about the
correctness of a model or an inference. This is the classic p(d|h) v p(h|d)
debate.

------
zdw
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, etc.

Basically, I want to know if they have a grasp of how things all go together,
and how to test the individual parts that make up the whole.

~~~
c0nsumer
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...".

~~~
nulagrithom
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.

~~~
c0nsumer
No, I'm saying that it's used as a blowoff answer for something that sounds
important because it's outside of what one in said job would normally do, but
when asked about it (to see how generalist the person is) they wave it off as
something for another person to handle.

------
freehunter
Information security. Our most basic interview demonstration question at my
job is to hand the candidate a couple pages of tcpdump output and ask them to
describe what was going on.

We don't use tcpdump all that often as we have more advanced tools, but if you
can't understand a pretty raw representation of network traffic, you're
probably not qualified to administer those advanced tools.

------
talmand
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.

~~~
tmcneal
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?

~~~
teebrz
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.

------
wengzilla
I was an electrical engineer before I was a computer programmer and people
liked asking questions about Ohm's law and calculating total resistance of
resistors in series and parallel.

EDIT: I should clarify... They weren't asking about the theory behind Ohm's
law but rather to apply it to various circuits.

~~~
PaulKeeble
That feels more like asking the difference between a class and object. Its not
really asking someone to solve nearly the simplest problem to prove they can
can code.

Would the equivalent not be making a basic circuit to do something specific
and hence a specific example that has one or two potential obvious issues?

~~~
walshemj
Sorry Ohms law is not like a class or an object in any way at all.

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

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

------
model-m
When I teach calculus 1, I usually put a "high discrimination" question at the
beginning of every exam. Student performance on that question is usually very
well correlated with the exam grade. It helps me quickly assess class
performance right at the start of the grading process.

Examples of such questions:

Draw the graph of a function f, continuous on the reals, such that: f(x) > 0
always, f'(x) < 0 always, and f''(x) always has the same sign as x.

The line y=3x-2 is tangent to the graph of y=f(x) at x=4. What is f'(4)?

------
jheriko
Hi - vfx/games programmer here - I've never been given FizzBuzz - although
similar problems generally appear on any programming test I've seen (reverse a
string, find loop in linked list etc.) the better ones I've seen a couple of
times now are:

"How do you reflect a vector about a normal? Name some uses."

"What is the dot product? Name some uses."

These aren't just filters but an experienced real-time rendering or physics
programmer is going to have quite a lot to say about the practical
implementations of either in particular situations and what hardware features
are available to help you with them...

if there is a good theoretical understanding then they can talk a lot about
what the dot product is, its relationship to matrix multiplication and tensor
inner products in general. they can explain multiple approaches to the problem
of reflecting the vector and derive their solutions from first principles
instead of just repeating remembered knowledge.

there are lots of little domain specific bits of knowledge as well e.g. the
reflection question can lead to discussion of the Blinn half angle
approximation - why it works and why its no longer a particularly valid
optimisation on today's hardware - the dot product question can lead to
discussion of how to efficiently handle solving a quadratic equation on the
GPU

really i expect a decent (games/vfx) programmer to run out of time whilst
elaborating on answers to either of these questions (although not to the
detriment of the rest of the test of course...).

the best filter is a strong demo though imo. never met a bad programmer who
has a decent demo... none of the average, lazy or bad programmers i've worked
with have one that i couldn't have crapped out in the evening before an
interview.

------
chm

      A nation's newest war ship is slowly disappearing. The ship's hull
      is made of Aluminium while its cannon bores are made of Stainless Steel.
      What is happening, why, and how do you stop it?
    

Grad school chemistry/physics candicacy exam question, sure to generate
colorful answers!

~~~
stevenrace
'Galvanic corrosion' and applying a non-metalic layer between the cannon/deck
would be my first thought. Now I'm curious as to some of the more 'colorful
answers'.

~~~
chm
Yes indeed: two different metals in electrical contact through an electrolyte
solution (sea water). One way to stop this is to use a sacrificial anode
(where the oxidation occurs) made of Magnesium, although this would probably
be unpractical in salt water. A colorful answer would be to replace the water
with a fluid like 3M's Fluorinert and replace the air with a nitrogen
atmosphere. But that would also be unpractical.

------
danso
For news reporters, there's the AP Style test, which gives you text/headlines
that you have to translate to the AP style, which is its own kind of grammar
(e.g. for state abbreviations, Calif. instead of CA; always use [numerical-
age]-[old] in describing ages: 15-year-old). It's a test more geared toward
editors though.

In terms of reporting...there's no litmus test for how well you can report an
event. The education beat, however, is pretty common for new reporters (it was
my first), which is ironic considering how ridiculously complicated education
is as a topic (same kind of financial/budgetary documents as any business,
government bureaucracy, board politics, and of course, dealing with children)

------
sbhere
Imaging science. If I were hiring another imaging scientist:

Write your own Fourier Transform. [If your FizzBuzz questions involve actually
writing/coding the FizzBuzz, I'd not request actually writing it...]

~~~
lp251
I wonder how effective of a test this would be. Are the algorithmic &
implementation details of the Fourier transform that important to imaging
science? I would imagine that explaining the properties of the FT, it's
connection to imaging modalities, etc would be far more relevant than actually
coding a DFT.

How would you weight a naive implementation of the DFT vs the FFT?

~~~
0x09
>How would you weight a naive implementation of the DFT vs the FFT?

Luckily he didn't specify the dimensional requirements, so we can get away
with f^[0] = f[0].

------
pawn
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.

~~~
aaronem
I'd be curious to see that test.

~~~
pawn
Think you might be interested in applying? :-)

We're hiring...

~~~
aaronem
No thanks; I'm happy with the job I've got right now. But I appreciate you
asking!

More seriously, shouldn't it be possible to post a version thoroughly enough
sanitized to avoid giving the game away to your potential applicants, without
losing the sense of the original? You don't identify your organization in your
HN profile, so it doesn't seem terribly likely anyone who's looking for hints
on your hiring process will find it. And, hey, it's entirely possible you'll
get feedback which helps improve the question you're actually using in your
interviews!

~~~
pawn
I might see if I can come up with something approximating the test... The
tricky part about making it so that people online could take it is that I'd
need to give you an avenue to play around in a query editor and run queries on
a database I've created. Short of making a publicly available database on my
own domain (which uses a different database platform than what we use at
work), is there a good way to accomplish this?

~~~
aaronem
Looking at it from another angle, I'm considering the same question, because
I'd like to build the "You Can't SQL Under Pressure" somebody else mentioned
in this thread. But I'm not all that happy about the idea of letting random
users run arbitrary queries against a database I'm hosting, because it seems
like protecting that against SQL injection and similar vulnerabilities would
be extremely difficult if not entirely impossible.

I'd use the Web SQL Database stuff that W3C was working on, except that they
stopped doing that in 2010, which guarantees the corpse is dead and rotting;
unfortunately, the only emulation libraries I've been able to find implement
various key-value stores on top of WebSQL, which is the precise inverse of
what I'd need.

I suppose it'd be theoretically feasible, albeit hideously ugly, to create and
populate a fresh database and account per user on a MySQL engine; with careful
grants and a bit of scripting to kill slow queries before they can multiply
and throttle the server, that might be workable on the small to medium scale,
although I don't doubt a "Show HN" post would kill it in short order.

Thinking about it, I suspect I've more or less recapitulated why there is
currently no "You Can't SQL Under Pressure"; it's a more subtle problem than
it seems at first blush. If you come up with any clever ideas on the subject,
I'd love to hear about them!

------
sheetjs
My Math "FizzBuzz" question is: prove Fermat's Little Theorem and Wilson's
Theorem. Even those with very rudimentary understanding of modular arithmetic
(coming from non-math backgrounds) can prove both with some pointers
(obviously the process is interactive)

~~~
crntaylor
Interesting. I think the proof of Wilson's theorem is easy enough to be
accessible for a non-mathematician - for non-prime n you can find a pair of
numbers in the product (n-1)! that are congruent to 0 (mod n), and if n is
prime then you pair up numbers in the product with their inverses until you
are left with ±1.

But I can't think of a similarly low-level proof of Fermat's Little Theorem.
Is there an obvious one I'm missing?

~~~
ColinWright
Consider Q to be the product (p-1)!. Then consider the product
a.2a.3a.4a...(p-1)a. These are the same items rearranged, because a has an
inverse.

But the product is also a^(p-1).(p-1)! by commutativity. So a^(p-1)=1 (mod p).

There's a clever idea in there, to consider prod(ka) for fixed a and
k=1..(p-1). Not finding the clever idea means you won't prove it. Finding the
clever idea is tricky. Once you know the clever idea the proof is trivial.

------
thearn4
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 characterization/pattern
extraction via FFT/DCT/SVD/wavelets/ICA/etc.

Finally, I would construct some problems involving appropriate selection of
statistical inference models and associated tests of hypothesis (from the
usual the Fisher and Neyman-Pearson perspectives). The basics of Bayesian
inference is good to know as well.

~~~
ColinWright
Interesting - this is exactly the kind of answer I'm looking to learn from.
Are these really so utterly fundamental that someone could do them under
pressure without thinking?

Is it the case that someone who can't answer these near automatically is, in
effect, incompetent (in this field)?

I'm wondering if you've set the bar higher than FizzBuzz is in computing, or
if this really is equivalent.

Thanks!

~~~
tel
I would agree with the op here. SVD in particular is so fundamental to the
idea of data analysis I couldn't imagine talking to someone who even flinched
at hearing it. Most other things fit at roughly the same level in my mind.

I feel like the mechanics of test selection biases against people who've
specialized in Bayesian stuff—which might be very interesting! It's definitely
a make-or-break kind of thing as to whether you can correctly formulate all
the various moving parts and relate them correctly.

------
smokey42
My pet problem after FizzBuzz has been this for some time now:

    
    
        You are given a text in a file. Count all the words in the
        text and print out the words with their number of occurences
        in descending order.
    

This can be depressing at times.

~~~
ColinWright
Define "word". However, strings separated by space:

Print number of words:

    
    
        wc -w <filename>
    

Print words with counts in decreasing order:

    
    
        cat <filename>  \
        | gawk '{for (i=1;i<=NF;i++) print $i}' \
        | sort          \
        | uniq -c       \
        | sort -rn      \
        | less
    

There are optimizations to be made, but that would be my go to solution in the
first instance.

------
coreyoconnor
Quality Assurance (QA) engineer. I do QA Tools specifically but still need to
be on top of most QA stuff. Other QA engineers exist in the company for in
depth QA.

My initial question starts with: "build a function that takes a string and
produces an integer". About 30% of candidates fail to get anywhere. 50%
produce an incorrect implementation. 20% produce an implementation that is
mostly correct. 9% produce an implementation that is mostly correct and well
tested. 1% actually produce a complete and correct response. Which, as of
right now, translates to exactly 1 candidate in 2 years. Who was rejected due
to culture fit. A complete and correct answer is not required to pass the
screen. ;-)

The reason this question is so effective is due to how the question is asked
and the details of the solution. There is a lot more than just the initial
problem statement. The full script assess: the candidates ability to determine
requirements; ability to produce complete set of unit tests; ability to handle
the boundary conditions.

There is a sharp division that occurs between QA engineers and non-QA
engineers on the requirements gathering. All but 1 non-QA engineer I've
interviewed assumed they had all the requirements before writing code. A
clever solution is almost useless if it solves the wrong problem. Sometimes
even worse than useless if the code adds a maintenance cost for no value.

Covering all the critical cases in testing is the next part that most
candidates fail at. Even if the requirements they assumed are correct, none of
the non-QA engineers have succeeded in writing a complete and good set of
tests. Many add too many tests.

After those two the other parts are just seeing how close they can get to
building the correct implementation. The candidates typically pass if they do
well in all parts; perfection is not required. Still, I think it's interesting
to note that almost nobody has ever written a 100% correct solution. Even if
they are given all the requirements in detail.

This question does not asses algorithm design ability. At all really. Well, I
suppose there was somebody who immediately proposed "binary search!" and
really wanted to stick with that idea. No clue why...

~~~
collyw
This would match your specification.

    
    
        def string_to_int(str):
            
            return 1

~~~
coreyoconnor
That would match the initial specification. The point is for the candidate to
note that the initial specification is too ambiguous and determine what they
do about it.

If they gave that answer and then said "which is why the specification is
weak" then great! If they gave that answer and called it done... well... not
so good.

------
linuxlizard
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.

------
solox3
Working for a web company. Our favourite JS question is,

"What happens if you do this?"

    
    
        var func = function func () {
            // blah
        };

~~~
ShellfishMeme
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?

~~~
thomaslangston
Could you go into more detail about why you would do A)

    
    
      var func = function func() { /* blah */ };
    

Instead of B)

    
    
      function func() { /* blah */ };

~~~
ShellfishMeme
Let's say you want to define a function to be used for a certain operation on
two numbers dependent on some boolean.

    
    
        if (addition) {
            // operation = add
        }
        else {
            // operation = subtract
        }
    

If you use function declarations you might run into bugs

    
    
        if (addition) {
            function operation (a, b) { return a + b; }
        }
        else {
            function operation (a, b) { return a - b; }
        }
        console.log(operation(1,2));
    

Here it might happen that you don't get the expected function.

Additionally it's much less clear what's going on. Compare it to this:

    
    
        var operation;
        if (addition) {
            operation = function add (a, b) { return a + b; };
        }
        else {
            operation = function subtract (a, b) { return a - b; };
        }
        console.log(operation(1, 2));
    

Here it's very obvious what's going on and your operation function has a name
that reflects what it does.

Personally I prever never to rely on function hoisting and always declare
functions using function expressions. It keeps the code style more consistent
and it's clearer what is happening in your program.

------
bentoner
For poker, I see if they understand how squeezing works.

~~~
r-s
when are you ever interviewing for a poker position?

I think that would be a good question though. Or even something simple like
"Explain how you could set-up a polarized 3bet range".

------
hacknat
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?

~~~
pliny
SVO?

~~~
Mvandenbergh
Subject-Verb-Object word order like English or most other European languages.
(I ate the apple).

Classical Arabic and other semitic languages are VSO, but spoken Arabic is
mostly SVO.

------
dxbydt
Based on interviews, POMDP has become a favorite FizzBuzz question for data
scientists. So make sure you have a working example for that. I usually
explain the tiger pot of gold in gruesome detail.
[https://www.google.com/search?q=tiger+pot+of+gold+pomdp](https://www.google.com/search?q=tiger+pot+of+gold+pomdp)

~~~
gallamine
Any recommendations for courses or books on Markov decision processes?

~~~
dxbydt
For whatever reason, pomdp has been co-opted by the AI community, so the books
are pretty lousy and show-offy, often using nonstandard terms and newfangled
jargon to explain what is really plain old probability theory with some state
space transitions.Thrun's Probabilistic Robotics is the best one I could find.
Any math professor can run circles around the material if it were treated as
part of math instead of bringing AI into the mix.

------
vvvVVVvvv
Technical support analyst in the online advertising biz.

Our Fizzbuzz equivalent would be to mess with some HTML / JS and ask the
interviewee to spot what's the issue. Or playing with a spreadsheet software
to highlight stuff (pivot table, filters, duplicates, whatnot).

------
warech
Not math but could be interesting anyway: Genomics, specifically quality
engineering. When hiring for my team we ask candidates to generally describe
1) DNA translation and 2) statistics for experimental design (AQL, RQL, etc).

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

~~~
aaronem
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?

~~~
presidentender
Can't we

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

~~~
code_duck
It's supposed to be recursive. That would only delete the files in the current
directory, not subdirectories as well.

~~~
presidentender
-r is the 'recursive' flag.

~~~
aaronem
Yes, but it doesn't do what you think it does. Feel free to try it for
yourself if you don't believe me.

------
agumonkey
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.

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

~~~
agumonkey
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...

------
aus_
I just saw Wolf of Wall Street this weekend. Has anyone in sales been asked
"sell me this pen" in an interview?

~~~
larrys
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.

~~~
run4_too
This explanation actually properly answers the question, in my mind. :-)

------
silvertonia
A DBA I worked with had a good one-- just asked a question that was the
textbook problem a left join solved.

------
ryanisinallofus
If someone has UX on their resume I ask them to draw up a user flow diagram of
getting groceries.

------
0xdeadbeefbabe
My FizzBuzz equivalent: do they say date-uh or dat-ah.

