3 ms·
Why not ask the candidate to solve a problem of the type that they are likely to encounter while actually working at your company: the kind of task that you wou
by jcrites 5y ago
Why not ask the candidate to solve a problem of the type that they are likely to encounter while actually working at your company: the kind of task that you would ask them to perform on day one.
Inverting a binary tree is not the kind of task that is a software engineer is likely to have to perform at most companies. I think companies can come up with better questions that still involve algorithms and data structures but better correspond to problems that they professional software engineer might actually need to solve.
For example, to repeat a comment I made elsewhere in this thread, ask them to serialize a binary tree to a byte stream, and deserialize the same tree from a byte stream. There are plenty of edge cases in this problem; you learn whether they understand a data structure (binary tree) and how to implement it, as well as how to write algorithms that operate on it (potentially a recursive descent on the tree; potentially a visitor, depending on how the candidate designed the tree).
This also isn’t a problem I’d directly expect to solve during regular work, but it’s useful and close enough: serializing/deserializing objects (data structures) is something I’ve had to do in reality plenty of times. (Even if you’re using an RPC library or IDL, you often have to “serialize“ in the sense of translating into the business object into one generated by the IDL or RPC client)
- paxys 5y ago"Invert a binary tree" is something that keeps coming up in discussions like this one but isn't a real question that is often asked. Some of the questions I have personally come across in coding interviews with large companies (Google, Uber, Square, Twitter, LinkedIn): - Implement a LRU cache - Implement a rate limiter - Read and process a very large file line by line - Combine two sorted streams - Calculate the sum of a specific section of a MxN grid - Parse and solve a math equation - Find the nth most common word in a blob of text These are all pretty realistic representations of what a software engineer can be expected to do day to day.
- deleted 5y ago[deleted]