TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Why are so many coding challenges about math?

43 点作者 athesyn大约 7 年前
And where can I find ones that aren't? I want to improve my skill but I don't feel like I should pick up advanced algebra or number theory just to do a coding assignment.

10 条评论

thirduncle大约 7 年前
-- &quot;Why do you keep looking for your car keys under the lamp post?&quot;<p>-- &quot;Because that&#x27;s where the light is.&quot;<p>Less snarkily: that&#x27;s because they traits that <i>really</i> matter in a modern development environment -- the ability to deal with ambiguity and complexity; to navigate the tipping points between technical perfection and optimal business value; and and top of all this, a genuine sense of <i>humility</i> and a willingness to work with others whose strengths and weaknesses are different from your own -- are very hard to test for, if they can be &quot;tested&quot; for at all.<p>But since the current interview &quot;process&quot; is so obsessed with &quot;testing&quot; and stack-ranking... not surprisingly, it&#x27;s largely rigged around traits that are... easy to &quot;test&quot; for.<p>Like you know, the ability to crank out rehearsed solutions to algorithm puzzles and the like.
cbanek大约 7 年前
I find it true that most coding challenges are either about math, or simple algorithms, such as path finding, DFS&#x2F;BFS, tree traversal, etc. I think it&#x27;s because they&#x27;re simple to explain in a quick way, and don&#x27;t involve the person needing to know libraries or frameworks.<p>That being said, most of the coding I&#x27;ve done in my life has been all about integrating different libraries and frameworks together. I don&#x27;t see a lot of complex algorithms, which is good (because they are complex, and probably someone else already wrote it better, with less bugs and better performance). I&#x27;d never want to work with someone who rolls their own red black tree into production code just for the lols.<p>That being said, I don&#x27;t think it&#x27;s a great way to evaluate candidates, because it&#x27;s not what most people do all day. I find problems about integrating systems, and understanding complex topics like networking, databases, testing, protocols, and APIs to be much more useful.<p>To find a good middle ground, I like to ask design questions, and then give people a &quot;library&quot; of functions they can call with prototypes, and tell them what they will do. This focuses on the logic of putting it together rather than off by one errors in loops, which still happens to me all the time. Those kinds of bugs are easy to fix when you can actually run the code, but a right pain on a whiteboard.<p>I&#x27;ll never forget the look of surprise on the interviewers face when I was doing an intern interview and asked &quot;can I use stdlib calls like memset and memcpy, or do you want me to write loops?&quot; I think just asking the question gave me huge interview points. (and yes, I got the job.)<p>Let me finish by giving an example of what I thought was a good coding assignment: Write a service that listens to rabbitmq and rotates the images 90 degrees and post them back to a different queue. This wasn&#x27;t about writing code to rotate images either, it was about knowing how things work, and stitching them together correctly (with the right error handling and failure modes).
kazinator大约 7 年前
Coding challenges involving number-theoretical math have small, simple input cases, and can be stated compactly, yet can be fairly complicated and subtle. They often have the property that it&#x27;s easy to test whether a solution is correct. They are also a good way to test someone&#x27;s understanding of subtleties in requirements; if you misunderstand some key element in the problem, you will solve the wrong thing. Some problems in this area will drag in the use of data structures; you may have to keeps some hashes or lists, or even construct a graph. Or generate permutations, or some sort of tree with backtracking and such; it&#x27;s not necessarily just numbers and nothing but numbers.
jeffmcmahan大约 7 年前
I figure the math-heavy tests probably represent an unconscious attempt by elite educated CS guys to homogenize the talent they hire, to build teams of people more or less like those doing the hiring - very smart and well-trained in a particular tradition. Smart matters of course, but a CS background, while worthy, is one among many ways of becoming a competent, creative, productive developer.
fwdpropaganda大约 7 年前
Because everything is math.<p>&gt; I want to improve my skill but I don&#x27;t feel like I should pick up advanced algebra or number theory just to do a coding assignment.<p>Really? Advanced algebra or number theory? Can you show me a coding assignment that required either? Are you sure you&#x27;re not just excusing your ignorance by suggesting that stuff you&#x27;ve been asked and didn&#x27;t know the answer to is somehow advanced when it&#x27;s really not?
评论 #16937162 未加载
评论 #16941043 未加载
imauld大约 7 年前
Because there is a right and wrong answer. There is very little ambiguity, either the algorithm you wrote on the white board will do the the thing in required time&#x2F;space complexity or it won&#x27;t. Which makes it easy to ask and easy to compare candidates.<p>IMO this is horribly broken but the Big 4 do it so everyone else does too.
sunstone大约 7 年前
Because it separates out those who went to Uni from those who learned to code in their basements.
评论 #16937443 未加载
评论 #16937662 未加载
beyondCritics大约 7 年前
<a href="http:&#x2F;&#x2F;codeforces.com&#x2F;blog&#x2F;entry&#x2F;23054" rel="nofollow">http:&#x2F;&#x2F;codeforces.com&#x2F;blog&#x2F;entry&#x2F;23054</a><p><a href="https:&#x2F;&#x2F;www.hackerrank.com&#x2F;calendar" rel="nofollow">https:&#x2F;&#x2F;www.hackerrank.com&#x2F;calendar</a><p>I think topcoder (<a href="https:&#x2F;&#x2F;www.topcoder.com" rel="nofollow">https:&#x2F;&#x2F;www.topcoder.com</a>) covers a wide spectrum, but i have never tried them.
评论 #16938299 未加载
mesozoic大约 7 年前
Why should I need to learn about measurements and rulers to design and build a house?
评论 #16937631 未加载
gnunez大约 7 年前
1. Because computer science is about mathematics (combinatorics, permutations, counting, etc) and sometimes interviewers want to make sure that the candidate&#x27;s foundation is solid.<p>2. As stated in earlier comments, because mathematics is unambiguous making the problem easy to state and easy to verify. Can you take a small piece of mathematics you may not be familiar with, understand it and translate that into working code? That is a core skill of any software developer -- not necessarily with just mathematics but you get the point.