Live data from Hacker News

Quant Job Interview Questions (2009) [pdf]

math.kent.edu

91–100 of 154 posts

Re: Quant Job Interview Questions (2009) [pdf]

#91

Earlier quoted context omitted.

This seems so simple. Decisions and draws are independent - we can ignore the other guy and just go for the highest value. Draw the first number. If it's below 0.5, draw again, since the odds then are that the next draw will be higher. Is there more?

I was 100% sure that redrawing below 0.5 is optimal, but a simple simulation disagrees: def tournament(a, b, n=1000): return sum(a() > b() for _ in xrange(n)) / n def redraw_below(c): x = random.random() if x `redraw_below(0.5)` only beats `redraw_below(0.6)` 0.4948 of the times, very consistently, over three sets of a million rounds. This is despite `0.5` giving a better average (0.624 vs. 0.620). I'll think about w…

When all else fails, test.

Re: Quant Job Interview Questions (2009) [pdf]

#92

Here's my favorite interview question (spent 10 years as a quant, interviewed a bunch of people, most do not do well on this) We're going to play a game. You draw a random number uniformly between 0 and 1. If you like it, you can keep it. If you don't, you can have a do-over and re-draw, but then you have to keep that final result. I do the same. You do not know whether I've re-drawn and I do not know whether you've…

This seems so simple. Decisions and draws are independent - we can ignore the other guy and just go for the highest value. Draw the first number. If it's below 0.5, draw again, since the odds then are that the next draw will be higher. Is there more?

Imagine being told exactly what number the other guy ended up with. Then, instead of maximizing value you would need to just redraw if you're below that number.

I haven't solved it yet, but it's definitely some kinda recursive formula where you have to assume the other guy is also playing the optimal strategy.

Re: Quant Job Interview Questions (2009) [pdf]

#93
post #79

Here's my favorite interview question (spent 10 years as a quant, interviewed a bunch of people, most do not do well on this) We're going to play a game. You draw a random number uniformly between 0 and 1. If you like it, you can keep it. If you don't, you can have a do-over and re-draw, but then you have to keep that final result. I do the same. You do not know whether I've re-drawn and I do not know whether you've…

Oh my god it's the golden ratio! That's so cool! EDIT: I'll show my work, rot13'd... Jr pna cnenzrgrevmr n fgengrtl ol n guerfubyq g: gur inyhr gung gur svefg qenj arrqf gb or yrff guna va beqre gb pubbfr gb qenj ntnva. Hfvat guerfubyq g, gur cebonovyvgl bs trggvat yrff guna g vf g^2 orpnhfr lbh unir gb qenj orybj gur guerfubyq gjvpr va n ebj. Gung chgf gur cebonovyvgl bs raqvat hc nobir gur guerfubyq ng 1-g^2. Gur c…

Indeed it is!

Re: Quant Job Interview Questions (2009) [pdf]

#94
post #92

Earlier quoted context omitted.

This seems so simple. Decisions and draws are independent - we can ignore the other guy and just go for the highest value. Draw the first number. If it's below 0.5, draw again, since the odds then are that the next draw will be higher. Is there more?

Imagine being told exactly what number the other guy ended up with. Then, instead of maximizing value you would need to just redraw if you're below that number. I haven't solved it yet, but it's definitely some kinda recursive formula where you have to assume the other guy is also playing the optimal strategy.

> but it's definitely some kinda recursive formula where you have to assume the other guy is also playing the optimal strategy.

I think it can be solved by searching for a pure strategy nash equilibrium

Re: Quant Job Interview Questions (2009) [pdf]

#95

Earlier quoted context omitted.

This seems so simple. Decisions and draws are independent - we can ignore the other guy and just go for the highest value. Draw the first number. If it's below 0.5, draw again, since the odds then are that the next draw will be higher. Is there more?

I was 100% sure that redrawing below 0.5 is optimal, but a simple simulation disagrees: def tournament(a, b, n=1000): return sum(a() > b() for _ in xrange(n)) / n def redraw_below(c): x = random.random() if x `redraw_below(0.5)` only beats `redraw_below(0.6)` 0.4948 of the times, very consistently, over three sets of a million rounds. This is despite `0.5` giving a better average (0.624 vs. 0.620). I'll think about w…

I had a longer answer, but the distribution is important. A 0.5001 has a less than 50/50 shot of winning.

Re: Quant Job Interview Questions (2009) [pdf]

#96

Earlier quoted context omitted.

This seems so simple. Decisions and draws are independent - we can ignore the other guy and just go for the highest value. Draw the first number. If it's below 0.5, draw again, since the odds then are that the next draw will be higher. Is there more?

- edit: To explain, why not 0.5? Because the probability of your opponent having drawn a smaller number than 0.5 after two attempts is 0.5. A strategy of keeping >=0.5 after the first draw will loose against the optimal strategy on average.

Definitely not 67% of cases, more like 50% + epsilon:

    def round():
        x = random.random()
        if x = y

    sum(round() for _ in xrange(10000000))
    5001450
    sum(round() for _ in xrange(10000000))
    5004434
    sum(round() for _ in xrange(10000000))
    5000238
I also ran a test of 0.6666 vs. 0.625, and... sorry to say, but 0.625 wins hands down.

Re: Quant Job Interview Questions (2009) [pdf]

#97
post #79

Earlier quoted context omitted.

Oh my god it's the golden ratio! That's so cool! EDIT: I'll show my work, rot13'd... Jr pna cnenzrgrevmr n fgengrtl ol n guerfubyq g: gur inyhr gung gur svefg qenj arrqf gb or yrff guna va beqre gb pubbfr gb qenj ntnva. Hfvat guerfubyq g, gur cebonovyvgl bs trggvat yrff guna g vf g^2 orpnhfr lbh unir gb qenj orybj gur guerfubyq gjvpr va n ebj. Gung chgf gur cebonovyvgl bs raqvat hc nobir gur guerfubyq ng 1-g^2. Gur c…

This... rings so right... but me and probably many other programmers here lack the math to see the explanation immediately in front of our eyes when we hear the answer. Can you please elaborate? Edit: thanks. This is convincing, but... given that we're looking for a fixed point of a process like... [bah, I lack words to describe a vague, non-rigorous intuition]... I expect that there is a convincing one-sentence expl…

Your intuition is better than mine! I crunched it out (just now edited my answer to show how) but still have no intuitive sense of why it should be the golden ratio. Would love to hear some intuition for that!

Re: Quant Job Interview Questions (2009) [pdf]

#98

Earlier quoted context omitted.

That was my analysis as well. What the other guy does is unknown and therefore irrelevant. If you can improve your current expectation, you do. You can trivially search over that strategy space and see that, yep, 0.5 is the maximum. #include #include int main(int argc, char *argv[]) { for (double d = 0.25; d

Careful, working in a language without a REPL encourages you to explore less. I was working in Python, and I did this and was about to post it, but then I asked myself "well, it can't be so easy, right? Why don't I also run a two-player simulation and make sure this strategy actually beats 0.6 first?", and - see my sibling post - it surprisingly loses. I can't yet explain why[1], but you can't argue with facts. [1] p…

> I can't yet explain why

Your comment and simulation prompted me to attempt an explanation of where danielvf's analysis is incorrect, which I've posted here https://news.ycombinator.com/item?id=12941330

Re: Quant Job Interview Questions (2009) [pdf]

#100

Earlier quoted context omitted.

You are agreeing with my solution? Though in this problem it seems the "average" final number would be 0.625, not 0.75 - since half the time you have an 0.75 expected outcome and the other half a 0.5 expected.

I think the point is that your strategy isn't independent of your opponent. Maybe a similar example is nontransitive dice: https://en.wikipedia.org/wiki/Nontransitive_dice In other words, it isn't sufficient to shoot for the highest score possible.

Absolutely. I was inspired by non transitive dice to create the problem.
Post reply on HN