Live data from Hacker News

Data structures and algorithms interview questions and their solutions

techiedelight.quora.com

11–20 of 36 posts

Re: Data structures and algorithms interview questions and their solutions

#11
post #6

If this isn't a metaphor for the programming interview I don't know what is: http://www.techiedelight.com/multiply-two-numbers-without-us... "Implement multiplication without using loops." "Uh, okay. What do you mean by loops?" "Don't use a conditional loop." "What do you mean by a conditional loop?" "Oh, you know, the standard definition." Time passes. "I'm stuck. What is the answer?" "Oh, you just have a loop on b…

> Multiply two numbers without using multiplication operator or loops

Uh, ok:

a * b = b != 0 ? a/(1/b) : 0

Done.

EDIT: handle division by zero.

Re: Data structures and algorithms interview questions and their solutions

#15
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.

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?

Re: Data structures and algorithms interview questions and their solutions

#16

Sadly, the code examples all seem to be in C++ ... not exactly the ideal language for pedagogy.

They have stuff like bit manipulations and the likes, C++ makes sense for those.

Doesn't virtually every programming language have operators for bit manipulation?

Re: Data structures and algorithms interview questions and their solutions

#17
post #6

If this isn't a metaphor for the programming interview I don't know what is: http://www.techiedelight.com/multiply-two-numbers-without-us... "Implement multiplication without using loops." "Uh, okay. What do you mean by loops?" "Don't use a conditional loop." "What do you mean by a conditional loop?" "Oh, you know, the standard definition." Time passes. "I'm stuck. What is the answer?" "Oh, you just have a loop on b…

Mult(A,B) = Exp(Log(A) + Log(B))

Re: Data structures and algorithms interview questions and their solutions

#19
post #17
post #6

If this isn't a metaphor for the programming interview I don't know what is: http://www.techiedelight.com/multiply-two-numbers-without-us... "Implement multiplication without using loops." "Uh, okay. What do you mean by loops?" "Don't use a conditional loop." "What do you mean by a conditional loop?" "Oh, you know, the standard definition." Time passes. "I'm stuck. What is the answer?" "Oh, you just have a loop on b…

Mult(A,B) = Exp(Log(A) + Log(B))

You didn't pass (overqualified, will likely be bored by the job).
Post reply on HN