r/programming • u/ldxtc • Sep 22 '20
Google engineer breaks down the problems he uses when doing technical interviews. Lots of advice on algorithms and programming.
https://alexgolec.dev/google-interview-questions-deconstructed-the-knights-dialer/
6.4k
Upvotes
4
u/itsgreater9000 Sep 22 '20
Isn't this assuming stuff about the codebase though? You say that underneath it is basically a graph - does this include the time it took to build up the knowledge of which data structure to use (since it seems like it is "basically" a graph), and the engineering discussions that went on which I assume were not as high pressure as in an interview?
From my experience, I see clever solutions that exist most frequently have evolved over time as more of the information necessary became apparent, and stuff had to be hacked on to make something "look" similar to some existing data structure. For example, at work we were given one set of specs for initial development which did not make it clear we were doing a directory style implementation of something, so the data structure was effectively a matrix (list of lists style) during the initial set of work. As more information unfolded we realized we needed to implement a tree like structure that mimicked a directory. Since we didn't have the time to rewrite the core of the code, we had to hack on the kind of stuff you would find in a typical application that knows about it being a tree, for example finding the leaf nodes (files) and recursing up and finding metadata about objects in the "path". Obviously the solution is not at all optimal, but given that it's a tool that is seeing minor use at best, we decided it was more advantageous to put effort into other stuff and quickly hack on solutions for what we needed.
I mainly ask because the insight needed to come up with this was only apparent when all the requirements were in - before, when the requirements were not clearly defined we had to go and implement whatever made sense. The result is that if I were to interview someone with that, I'd have to make sure it was pretty clear what was happening about the underlying data, otherwise I would risk losing out on the knowledge that developed during the project which eventually created a tree-"like" structure.
To me, this makes these types of situations substandard for doing interview questions (exception being when all the requirements are known), since there is so little time to stew on the idea that probably happens when doing work.