5 ms·
Let me point out a slightly different whiteboarding approach I've used. I give you the problem. I give you the solution too! I will even explain the solution pa
by dxbydt 15y ago
Let me point out a slightly different whiteboarding approach I've used. I give you the problem. I give you the solution too! I will even explain the solution patiently, line by line, until you are absolutely convinced.
Then I simply grow the problem - just one tiny step.
I ask for the solution for this new problem.
And guess what ? Most people still flunk!
Here's the problem I use( we are a quant outfit ):
---
Say I have $100 in 1 dollar bills.
How to make the most money if I have to split it between google and apple ?
---- solution --
val apple = (0.015,0.1) // 1.5% return/month, 10% risk
val google = (0.008,0.05) // 0.8% return/month, 5% risk
val rho = 0.4 // google apple correlation is 40%
// returns are weighted means
val myreturns = (0.0 to 1.0 by 0.01).map(x=>(x * a._1 + (1-x) * b._1 ))
// risks are standard deviations
val myrisks = (0.0 to 1.0 by 0.01).map(x=>sqrt( x * x * a._2 * a._2 + (1-x) * (1-x) * b._2 * b._2 + 2 * x * a._2 * (1-x) * b._2 * rho))
// sharpe = my return over my risk
val sharpes = (0 to 100).map(x=>myreturns(x)/myrisks(x))
// goal is to make most money ie. max sharpe
println( "Most money has sharpe:" + sharpes.max )
------
Now let me grow this problem, by just 1 more stock.
I have $100 in 1 dollar bills.
I give you 3 stocks: google, apple and amazon.
How to make the most money ?
This stumps so many people I have lost count! The ones who do well have usually taken a semester of undergraduate combinatorics, so they see instantly what needs to be done.
- forrestthewoods 15y agoThat's a terrible programming question. You might as well just ask "Hey, did you take combinatorics in school? Ok, cool."
- gcp 15y agoIf that's important for his company, why not? It's like the people that apply for a programming job and complain they get O(n) questions. Also, it doesn't just test if they took it. It also tests whether they understood it and can apply it. (You would expect the schools to do that, but...) Of course, if this question requires combinatorial knowledge, and its irrelevant or not critical for the job, then that's just bad.
- gcp 15y agoI don't really know anything about this, and I'm finding the code written hard to understand (what language is this?). If I would have to guess, you need to add var amazon = (foo, bar), adjust myreturns and myrisks to calculate over 3 arguments (or generalize them). Then modify the maps to map over 2 variables instead of one (like nested loops). The allocation is the x,y in sharpes() that gave sharpes.max, though I have no idea how to get that out of this language. Edit: Ok, so you need to define another rho, and the problem is that a) not all mappings over x,y (0->1) are valid allocations a) the stocks are discrete. So that's where the combinatorics come in, as you need to consider all possible combinations of allocating 100 dollars over 3 stocks, and then map over that instead. I'd have absolutely no idea how to express that in this language. Also, what are the stock prices? Google, Amazon and Apple all trade at >100USD/share. You can't buy fractional shares, can you? PS. One thing I like in this approach is that you're requested to understand code that's already written. This is what happens in real life, too.
- roel_v 15y agoIs there any way for somebody with 10+ years of C++ experience but little to no 'real mathematics' skills (meaning: I know what sin and cos are and can multiply two matrices, which probably puts me in the 90th percentile of the general population when it comes to math, but I have no idea what 'combinatorics' are) to work in some capacity at a hedge fund (well, technical capacity, not sweeping floors ;) ) ?