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.
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?
Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?
161–170 of 363 posts
Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?
#162For 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.
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?
Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?
#163Earlier 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.
0.5005?
There's a .999 chance you have a fair coin and a .001 chance you have the rigged coin.
(0.999 * 0.5) + (0.001 * 1) = 0.5005.
Seems too simple, but a coin is a coin, right?
Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?
#164Earlier quoted context omitted.
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 samp…
Yeah, that's what I was taught. So what are people answering instead?
Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?
#165Earlier quoted context omitted.
Do you mind posting a simple walkthrough for the answer
Sure. The slick answer is The chance of picking the biased coin is 1/1000. The chance of seeing 10 heads from a fair coin is (1/2)^10 = 1/1024. These are nearly equal, so given that you've seen 10 heads, there is a 50/50 chance of having a biased coin. So the probability the next flip shows a head is P(H) = P(biased) * P(H|biased) + P(fair) * P(H|fair) = 0.75 The long answer - Yo want to figure out P(biased | 10H). U…
The OP is only asking what the outcome of the NEXT flip is, not the probability of flipping 11 heads in a row. Or did I read this wrong?
Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?
#166Earlier 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…
I would give points for just asking that question, because many people bound by conventional thinking wouldn't dare to ask it, accepting default assumption that you can't. I'm not saying this says anything about your ability to solve the problem, but asking the question is a good sign of a supple mind.
Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?
#167I 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…
Do you mind posting a simple walkthrough for the answer
When we have the double heads coin, the probability of getting 10 heads is 1: P(10 heads|fake) = 1. When we have a normal coin, the probability of getting 10 heads is P(10 heads|fair) = 0.5^10.
The quantity we want to compute is
P(heads|10 heads) = P(fair|10 heads)*0.5 + P(fake|10 heads)*1
= P(fair|10 heads)*0.5 + (1-P(fair|10 heads))
= 1 - P(fair|10 heads)*0.5.
To compute P(fair|10 heads) we use Bayes' rule: P(fair|10 heads) = P(10 heads|fair) * P(fair)/P(10 heads)
Here P(10 heads) = P(10 heads|fake)*P(fake) + P(10 heads|fair)*P(fair)
= 1*0.001 + 0.5^10*0.999.
We fill in the formula we got by Bayes' rule: P(fair|10 heads) = 0.5^10 * 0.999 / (1*0.001 + 0.5^10*0.999)
Then we fill in the original formula: P(heads|10 heads) = 1 - 0.5^10 * 0.999 / (1*0.001 + 0.5^10*0.999) * 0.5
= 0.75308947108Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?
#168This 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.
Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?
#169Earlier quoted context omitted.
Sure. The slick answer is The chance of picking the biased coin is 1/1000. The chance of seeing 10 heads from a fair coin is (1/2)^10 = 1/1024. These are nearly equal, so given that you've seen 10 heads, there is a 50/50 chance of having a biased coin. So the probability the next flip shows a head is P(H) = P(biased) * P(H|biased) + P(fair) * P(H|fair) = 0.75 The long answer - Yo want to figure out P(biased | 10H). U…
Isn't the gotcha of this test the fact that the history of previous coin flips has no effect on the next flip , given a fair coin? The OP is only asking what the outcome of the NEXT flip is, not the probability of flipping 11 heads in a row. Or did I read this wrong?
Re: Ask HN: What's your speciality, and what's your "FizzBuzz" equivalent?
#170Working for a web company. Our favourite JS question is, "What happens if you do this?" var func = function func () { // blah };
It looks to me like what happens is exactly what you'd expect, i.e., you end up with a function defined under the name "func", just as you would with any other function name. Is there something I'm missing?
var func = function(){};
function func(){};
The example above is doing both at the same time... don't know if it's a mistake on their part or not.However they're probably wondering if the user knows about scope and other such things. Inside the brackets we have a new scope but it has access to top level scope as well. They want to know that you know that stuff.
Try any of the two lines above in a js console (in browser) then type:
window.func
this.func
func
The result should be the same.