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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Data structures and algorithms interview questions and their solutions

180 点作者 abhimt超过 7 年前

8 条评论

hanoz超过 7 年前
Didn't most of us get in to this mathsy line of work precisely because we didn't need to memorise a load of stuff and could just work things out from first principles as and when required?
评论 #15474965 未加载
评论 #15476451 未加载
评论 #15474926 未加载
评论 #15475926 未加载
munin超过 7 年前
If this isn&#x27;t a metaphor for the programming interview I don&#x27;t know what is: <a href="http:&#x2F;&#x2F;www.techiedelight.com&#x2F;multiply-two-numbers-without-using-multiplication-operator-loops&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.techiedelight.com&#x2F;multiply-two-numbers-without-us...</a><p>&quot;Implement multiplication without using loops.&quot;<p>&quot;Uh, okay. What do you mean by loops?&quot;<p>&quot;Don&#x27;t use a conditional loop.&quot;<p>&quot;What do you mean by a conditional loop?&quot;<p>&quot;Oh, you know, the standard definition.&quot;<p>Time passes.<p>&quot;I&#x27;m stuck. What is the answer?&quot;<p>&quot;Oh, you just have a loop on b dividing it by 2 using shift operators until it is zero.&quot;<p>&quot;Wait a minute, you said you couldn&#x27;t use loops.&quot;<p>&quot;Did I? Ah, well.&quot;<p>Hackerrank&#x2F;leetcode exercises are written the same way. So many times that a problem asks &quot;Output the indexes of two numbers in the array such that their sum is K&quot; and you write your code and the website says &quot;INCORRECT! You said [3,6] but the right answer was [6,3]&quot;. Addition is commutative! The two are equal! And both right!
评论 #15474978 未加载
评论 #15475188 未加载
评论 #15475335 未加载
评论 #15475954 未加载
sp527超过 7 年前
Most interview questions are ridiculous and don’t test for the knowledge a candidate should have. When I interview, I ask a system design problem that involves using an inverted index, a bst, understanding how to normalize data, and then being a little clever when merging some data. It tests fundamental concepts in the context of building a working solution to a meaningful problem.<p>I never understood why anyone would ask say DP questions in an interview. We don’t use that in 99.9% of software (I’ve never once in my career found a use case). What you’re really testing is whether or not the candidate had enough time to refresh that material. Worse still, it involves a very rigid solution pattern that’s over-specified to that class of problem and tells you nothing about what you want to know: can a candidate synthesize concepts to devise a solution to problems we actually encounter?
ccleary00超过 7 年前
I&#x27;d rather just not interview at companies that have these kinds of interviews and save myself the hassle.
评论 #15475855 未加载
pmoriarty超过 7 年前
Sadly, the code examples all seem to be in C++ ... not exactly the ideal language for pedagogy.
评论 #15475267 未加载
评论 #15475203 未加载
manigandham超过 7 年前
If anyone asks these questions without a particular scenario to actually deal with in the course of the position you&#x27;re interviewing for, you are in for some bullshit at that company. This has become all too common at the major corporations sadly.
bloaf超过 7 年前
Am I stupid or do both of the solutions to the problem<p>&quot;Replace each element of array with product of every other element without using &#x2F; operator&quot;<p>use the &#x2F; operator?<p>My solution would involve summing the log() of the values in the array.
评论 #15475483 未加载
tgarma1234超过 7 年前
That&#x27;s a great list worthy of study in any context.
评论 #15476189 未加载
评论 #15475533 未加载