Live data from Hacker News

My Most Interesting Interview Problem

austinrochford.com

31–40 of 56 posts

Re: My Most Interesting Interview Problem

#31

Earlier quoted context omitted.

> Why is your construction 'uniform' on the circle? That's a very good question, and the sort of thing that would need to be in a comment somewhere. The answer is that the bi-normal distribution is rotationally symmetrical, a fact that is not immediately obvious. > I'd rather take a random uniform distribution > from 0 to pi and take it as the arc-length. That's a good solution for the simple one-dimensional circle i…

Use a space-filling curve?

this a a cute idea, but i don't know of one (on the surface of a sphere). do you? also, are all space-filling curves uniformly dense in the limit? (presumably it depends on how you transform from a plane to a sphere, and if you get that right, you can just use it directly)

Re: My Most Interesting Interview Problem

#32
post #3
post #2

For the interested, the easieat way of generating random points on a circle is drawing (x,y) component-wise from a normal distribution and then normalizing the vector. (And two independent Gaussian variables can be easily sampled using the Box-Muller transformation.)

I'd rather take a random uniform distribution from 0 to pi and take it as the arc-length. Why is your construction 'uniform' on the circle?

I think you meant 2*pi? Wouldn't that only fill the top half of the circle?

Re: My Most Interesting Interview Problem

#33
post #32
post #3

Earlier quoted context omitted.

I'd rather take a random uniform distribution from 0 to pi and take it as the arc-length. Why is your construction 'uniform' on the circle?

I think you meant 2*pi? Wouldn't that only fill the top half of the circle?

Yes I obviously did mean 2*pi but I always get confused with these two numbers...

Not that it matters much, being a lecturer in Mathematics...

Re: My Most Interesting Interview Problem

#34

What are the practical applications to something like this?

Video game controllers.

DirectInput joystick data outputs a square range (0,0)->(65535,65535) which is usually uniformly remapped to a circle to be used by the game. Then you have to add in a dead zone to eliminate the noise from the controller around the neutral position.

Re: My Most Interesting Interview Problem

#35
Bertrand's Paradox addresses a separate issue but illustrates how subtle issues like this can be http://en.wikipedia.org/wiki/Bertrand_paradox_(probability) . The geometric interpretation that the OP offered in which he noted that the map had to be area preserving is a nice way of visualizing why the given implementation doesn't hold but that's just the start. As for the implementation this is also a great example of when something is hard to do in one coordinate system but trivial in another. Polar coordinates are the way to go.

Re: My Most Interesting Interview Problem

#36

in clear probability related context, the guy uses "uniformly distributed" and "normally distributed" interchangeably. I usually fail interview with such guys. The most recent spectacular failure happened when interviewer asked about sets, i described Java Set interface as an example (they are Java shop so i thought the choice was right), looking dissatisfied he asked to talk about "sets" in general, and got, lets sa…

[deleted]

Re: My Most Interesting Interview Problem

#37

in clear probability related context, the guy uses "uniformly distributed" and "normally distributed" interchangeably. I usually fail interview with such guys. The most recent spectacular failure happened when interviewer asked about sets, i described Java Set interface as an example (they are Java shop so i thought the choice was right), looking dissatisfied he asked to talk about "sets" in general, and got, lets sa…

It's not a good idea in an interview to antagonize your victims like this. The goal is to find out what they know, not be a forum for you to show off what you know. This is a very common mistake by interviewers.

Re: My Most Interesting Interview Problem

#38
Should not be described as points on a circumference?

Doing it about points in a circle made me think of a different problem (which is also interesting)

(Just to clarify, the circumference is the line that contains a circle. I assume that won't be misnamed in a geometry problem of this kind)

Re: My Most Interesting Interview Problem

#39
post #11

Earlier quoted context omitted.

I have to disagree with this. It would easier conceptually and faster computationally to use rejection sampling: do { x = uniform() y = uniform() r = x*x + y*y } while (r > 1) x = x/sqrt(r) y = y/sqrt(r) This does generalize to higher dimensions d, although as d gets large, you waste more samples. For spheres embedded in a handful of dimensions, it would still be fine, and it avoids all the transcendental functions a…

It's simple, clean, clear, and works well in low dimensions. I regularly work in a few thousand dimensions, and it doesn't work at all because the volume of the sphere is too small. These are great discussions to have with a candidate. If they already know these things then you can see if they understand why, and if they don't already know these things, you can see how they react to learning new and rather esoteric s…

Intriguing, what do you use something like this random multi dimensional sphere for?

Re: My Most Interesting Interview Problem

#40

For a general-purpose developer interview question, I think this relies a little too heavily on domain-specific knowledge to be generally useful. Personally, while I was quite decent at algebra and geometry in university, my skills have atrophied significantly, to the extent that I really didn't know where to start with this problem. I don't think it represents what most programmers do on a day-to-day basis, and some…

Completely agree. While I feel I could probably figure it out given time, in an interview setting I would test badly at this question. Does that mean I'm a terrible developer? I don't think so.

Interviews are tricky to get right. It's my opinion that interviews should aim to prove that the candidate knows enough to do the day-to-day work, plus test for good personality fit etc. After that, there should be a short probation period to learn more about each other.

Honestly, my perfect interview (as a candidate) would be a quick chat about my previous work experience, some one-on-one work with another developer to solve a common problem the company faces and then a few drinks with the team to get to know everyone.

Post reply on HN