Live data from Hacker News

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

news.ycombinator.com

291–300 of 363 posts

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

#291

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…

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

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

#292
post #284

Earlier quoted context omitted.

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

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…

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!

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

#293
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 do a very similar thing at my job, but instead of showing the results I ask for a report such as "we want to get X,Y and Z for the Ws where P holds true".

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

#294

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…

The bond prices question is a pretty bad filter, since it doesn't give the competent candidate much chance to express how they think, and a weak candidate has a good chance of guessing "they go down" and even a fair chance of blustering their way through followup questions/explanations.

On the flip side, you could probably unintentionally trip up someone with a generally competent grasp of economics/stats but a lack of specific interest in bonds over terminology if your followup questions start asking them to distinguish between types of yield.

Same with exchange rates (although I do remember back in school in a competitive presentation being complemented on my confident and plausible sounding explanation of the effect of an interest rate rise on exchange rates that also happened to be the reverse of the correct answer :-) )

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

#295
post #280

Earlier quoted context omitted.

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.

It may be a useful sanity check to simulate the experiment multiple times to see the result: def choose_coin rand 0, :tails => 0 } 1000000.times do coin = choose_coin next unless all_10_heads? coin next_flip[flip_coin(coin)] += 1 end puts next_flip[:heads].to_f / (next_flip[:heads] + next_flip[:tails])

What's really interesting is that there are probabilistic programming languages where you can write a program that does a simulation just like you did, but the execution engine can compute the probabilities exactly and much faster too. It does this by computing along all possible paths in the program, and keeping track of the probability mass of each path, and then summing them all up in the end.

http://en.wikipedia.org/wiki/Probabilistic_programming_langu...

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

#296
post #281

Earlier quoted context omitted.

Yep, I worked at the company you're probably speaking about for 9 years (I say probably, because there are two...Walmart and JB Hunt). I just left Walmart 3 months ago, largely because I was ready for something new, and the place I work now is just a lot more cool. Big change for me, going from giant IT building to a company that has 25 people total. They had less than 20 when I applied and 9 people a year ago.

Well, I've never heard anything about JB Hunt's IT, for good or ill, so... That must be a weird change, yeah, but it sounds good on the whole. It's a shame the timing didn't work out on this; if I still lived in Memphis, I'd have jumped at the opportunity. (I didn't like living in Memphis very well -- Bentonville seems like it'd be much more congenial.)

I personally like Bentonville pretty well. People from larger cities often complain "there's not enough to do" but I'm a bit of a home-body myself, so that doesn't bother me. One nice thing about this area is you can get a house with 5 acres of land for between $100k and $200k that would be comparable to houses easily twice or three times as much in someplace like Seattle.

I know a little bit about JB Hunt's IT. They use COBOL and Java. They might have some other stuff, but they seem big on those two from what I've heard.

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

#297
post #204

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

Any recommendations for courses or books on Markov decision processes?

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

#298
post #11

Working for a web company. Our favourite JS question is, "What happens if you do this?" var func = function func () { // blah };

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?

Don't forget that the second func is unnecessary, unless it's a function that calls itself. Also it will show up as func when debugging instead of anonymous function.

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

#299
post #48
post #11

Working for a web company. Our favourite JS question is, "What happens if you do this?" var func = function func () { // blah };

nothing? What answer are you looking for here? either a) there's something I'm totally missing or b) this is a really silly "trick" question.

It's a good chance to show off your knowledge of hoisting.

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

#300

Earlier quoted context omitted.

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

-r is the 'recursive' flag.

Yes, but it doesn't do what you think it does. Feel free to try it for yourself if you don't believe me.
Post reply on HN