by screye · 5y ago · 0 comments
3 interview rounds and all asked linked lists questions back to back.
I was very honest in that in my 2 years on the job, (ML, DS) I had never once run into a situation where I would use a linked list. I didn't remember if Python even had a default linked list implementation and I decided to implement it from scratch. Wrong decision.
I didn't get through, but the choice of linked lists was quite bizarre, esp. for a Data Scientist position. I would have much preferred a coding question that was relevant to the job or a take home assignment.
Well, I guess it was a good signal nevertheless.
Aside: Linked lists in python have a built-in deque: https://docs.python.org/3.7/library/collections.html#collect...
(I still had to google that one)
At the end of the interview, I asked the interviewer to give me one scenario where a recursive solution would be the most efficient one. Blank stares.
That was my eye-opening moment. I would never work for a place that asks these ridiculously outdated copy-paste interview questions. Can't believe I put up with that shit for so long.
That makes sense - there are no such problems (which is obvious if you consider the fact that Turing machines don't have recursion - nor functions, for that matter).
> I asked the interviewer to give me one scenario where a recursive solution would be the most efficient one
That also makes sense, as recursion usually isn't a technique that will bring an efficiency edge over non-recursive technique. It might often bring maintainability and understandability edge, though.
Solving the problem using recursion highlights the fact that it has, well, a recursive solution - which means that the solution can be expressed as a set of operations on top of solution to a smaller instance of the original problem. This can be an important property to notice about a problem, whether or not you're going to solve it with the function that calls itself.
Additionally, some problems have a solution that can be nicely expressed as a set of mutually recursive functions (instead of just a single recursive function). These are harder to express non-recursively. Many parsers are written like this, for example the C# parser: https://news.ycombinator.com/item?id=13915150
Funnily enough, this is also what made me stop the Scala Coursera midway. They focus way too much on converting various problems into Tail-call recursion because Scala can optimize them.
Too often, the interviewers are just trying to emulate seeming smart out of some ego thing, haven't been trained how to interview and just emulate what they think they're supposed to do, or are too lazy to ask real-world questions.
IIRC from CS, every recursion problem can be turned into an iterative one. Even many production compilers contain handmade parsers are recursive primarily for maintainability, not for technical reasons. There are plenty of ways to make bottom-up parsers (LALR parser generators) that don't use recursion but they aren't as useful at generating diagnostics, especially explaining parse error reasons in human-readible language.
Also: https://knowyourmeme.com/memes/im-getting-too-old-for-this-s...
but the interview is always something like 1- reverse a (linked list.tree) using your language of choice 2- write code to solve the N-queen problem ...
Basically they ask bad question to evaluate data structure knowledge and ability to solve riddle.
But they ask 0 question related to the specific expertise required for the role they are trying to fill.
But to be fair at Wallstreet you are likely to work with quants and have to do integral :)
The absolute basics also apply obviously - good comments, variable names that I don't have to run the program to divine the meaning of for example.
I wouldn't try to judge this based on an interview or whiteboard however, real code written for fun rather than dance monkey dance
{a=>1, b=>2, c=>2} Have them swap keys and values.
See if they can cope with duplicates.
On large hiring spree (20+ hires, hundreds of interviews) I would walk in, give them that in any language they wanted.
Moment I saw they understood, I would let them know they passed and walk out. Let others handle the social aspects of interviews.
90% failed test or took ages to get to solution.
Remaining would finish it under a minute and be confused as to why we gave them such a trivial test.