TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

My Most Interesting Interview Problem

36 pointsby MidsizeBlowfishover 11 years ago

9 comments

VladRussian2over 11 years ago
in clear probability related context, the guy uses &quot;uniformly distributed&quot; and &quot;normally distributed&quot; interchangeably. I usually fail interview with such guys.<p>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 &quot;sets&quot; in general, and got, lets say, really confused, when i tried to elicit whether he means naive set theory - seeing that i didn&#x27;t hit what he wanted, i offered along the lines of Russel&#x27;s theory of types, ... the guy got almost angry and said &quot;just sets in general&quot;, and i kind of supposed that we settled on naive, though it sounded like he didn&#x27;t like &quot;naive&quot;... he asked what we can do with a set, like for example iterate over its elements, i noted that that of course depends on the set&#x27;s cardinality ... by look on his face at that moment it was really clear that the interview is finished.
评论 #6368436 未加载
评论 #6368990 未加载
评论 #6368427 未加载
评论 #6368667 未加载
ryanbrunnerover 11 years ago
For a general-purpose developer interview question, I think this relies a little too heavily on domain-specific knowledge to be generally useful.<p>Personally, while I was quite decent at algebra and geometry in university, my skills have atrophied significantly, to the extent that I really didn&#x27;t know where to start with this problem. I don&#x27;t think it represents what <i>most</i> programmers do on a day-to-day basis, and someone with a strong math background would probably be far more capable of answering this, despite not necessarily being a better developer.<p>If this sort of thing represents what developers at your company would likely be doing on a daily basis, I think it could be a relevant question. Otherwise, I think a question like this is very likely to inadvertently screen out good developers.
评论 #6368460 未加载
评论 #6367892 未加载
quchenover 11 years ago
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.)
评论 #6367852 未加载
评论 #6367630 未加载
评论 #6368190 未加载
评论 #6367922 未加载
评论 #6367671 未加载
评论 #6368603 未加载
评论 #6368178 未加载
评论 #6367971 未加载
susi22over 11 years ago
Q for the math guys:<p>Is this the closed form pdf of the angle distribution of one quarter of the circle?<p><a href="http://www.wolframalpha.com/input/?i=1%2Fcos%28min%28x%2Cpi%2F2-x%29%29+%28x+from+0+to+pi%2F2%29" rel="nofollow">http:&#x2F;&#x2F;www.wolframalpha.com&#x2F;input&#x2F;?i=1%2Fcos%28min%28x%2Cpi%...</a><p><i>1&#x2F;cos(min(x,pi&#x2F;2-x))</i><p>plus the normalization term to make \int(..) == 1:<p><a href="http://www.wolframalpha.com/input/?i=int+1%2Fcos(min(x%2Cpi%2F2-x))+from+0+to+pi%2F2" rel="nofollow">http:&#x2F;&#x2F;www.wolframalpha.com&#x2F;input&#x2F;?i=int+1%2Fcos(min(x%2Cpi%...</a><p>Constructed by arguing that the probability is directly proportional to the length of the hypotenuse.
评论 #6368621 未加载
lpageover 11 years ago
Bertrand&#x27;s Paradox addresses a separate issue but illustrates how subtle issues like this can be <a href="http://en.wikipedia.org/wiki/Bertrand_paradox_(probability)" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Bertrand_paradox_(probability)</a> . 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&#x27;t hold but that&#x27;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.
sopooneoover 11 years ago
To me, the answer to the actual question is so obviously &quot;no&quot;, that I was almost confused. It&#x27;s as though someone asked me, &quot;which direction is the floor?&quot; Anything that easy must have a trick.<p>So I though maybe it was related to &quot;points&quot; meaning actual rasterized pixels on the screen. The you get the slightly counter-intuitive result that the diagonal line actual has the <i>same number of pixels</i> as the vertical line, and thus will produce the same density of points on the circumference. However, this line of reasoning would require that we know the lines are far enough apart that they don&#x27;t overlap pixels.
fatmanover 11 years ago
What kind of job was this for? After stumbling through questions involving trees, arrays and other data structures, I have come to the conclusion that I&#x27;m a mathematician dressed up as a mediocre programmer.
评论 #6368029 未加载
sologoubover 11 years ago
What are the practical applications to something like this?
评论 #6368357 未加载
评论 #6368248 未加载
评论 #6368205 未加载
评论 #6368511 未加载
jaimebueltaover 11 years ago
Should not be described as points on a circumference?<p>Doing it about points in a circle made me think of a different problem (which is also interesting)<p>(Just to clarify, the circumference is the line that contains a circle. I assume that won&#x27;t be misnamed in a geometry problem of this kind)
评论 #6368494 未加载
评论 #6368518 未加载