It's not even that these questions are hard, most are genuinely a twenty minutes job top. It's having to do them on the spot while being judged for every line without the option of checking the docs, a set of conditions that will never show up in the real world
For me the problem is thinking in the spot on a optimized solution
Im already nervous for having to write the code with someone judging me, so i always end up writing something kinda ugly, then I get complaints that its not optimized(like using a double for loop)
Last time I had to make a function to print last k numbers of an n long Fibbonaci sequence sorted in lexicographical order. Did not know what lexicographical means, didn't matter that I wrote everything else and a quick Google would have been all I need, still didn't get the job
And that totally makes sense. If you are writing lower level code or libraries, best possible performance is much more critical than it is for general production high level code.
Linked lists are worse for caching because their elements don't live in a contiguous part of memory. So you need to fetch each element from slower memory where as with vectors you can keep a larger chunk of it cached.
And memory allocation also takes time so you're actually slower off than if you'd just double the capacity of the vector if reserves run out.
I see. How would you overcome this linked list limitation with a solution of O(1) time complexity and O(n) memory. You have 15 mins, psydo codes are fine, and donât worry about the gun pressing against your temple.
With chunks (i.e we have vectors of the same length and chain them together). Then you could go further and turn this into deques (T** under the hood iirc, at least that's how i implemented it years ago).
With vectors you can provide an approximate, what you think is appropriate, reserve at any point. It doubling itself means it stays roughly in the demanded domain of whatever you're doing if reserves run out.
*writing down note: candidate failed to address direct challenge, did not raise any question to clarify requirements or shown collaborative attitude. Pass.
In theory, in practice you're very rarely iterating them. The problem that is solves is that you can allocate anything anyware (allows for very simple allocators on embeded systems), and no matter what happens, the address of the elements doesn't change. In kernels, you're often referring to elements of the list by address, instead of iterating it. You can't do that with a vector that might get reallocated somewhere else. You only need to iterate if you're looking for something, and that usually only happens during clean up or with introspection tools (eg. Listing processes). The most common operations (append, and delete) are also very cheap compared to a vector where you will potentially need to move large chunks of memory on delete, or on append when reallocation happens.
i benchmarked it std::vector push_back() with 100 million integers: 71.27 milliseconds
std::list push_back() with 100 million integers: 1.68 secs
std::vector reserve() + push_back() with 100 million integers: 27.6 milliseconds
You gotta keep in mind that the vector keeps doubling its total capacity whenever its reserves run out so you're actually just doing log2(n) allocations. So with 1 million elements i have to copy 20 blocks.
With a list i have to do 1 million allocations. This is just more expensive. Ig deletion may be faster but you could just flag the element as deleted and if the vector uses too much memory, you shrink it. And if order and iterator validity doesn't matter, you can just do a swap & pop with the last element.
Game engines with entity component systems already keep lots of giant vectors for components and clamp sparse sets on top. The sparse sets, which consists of a sparse and dense array, gives you an entity id and allows you to keep track of who owns what. So removal of a component is constant. It achieves that by flagging it invalid in the sparse array and swap&pop the component you want to remove in the dense array and component pool. Insertion is also constant so long as the dense array and the pool have enough reserves. It's also cache friendly.
Great solution to eat all memory in a kernel. Good thing that games are so well optimized these days. A guy said that he works as a kernel developer and he uses lists, another replied that it makes sense because of performance, then you jumped in to "akchyually" show them that they are wrong. Dude, get help. Go to a therapy or something.
No i think i just replied to the wrong comment lol. The other one said that linked lists are generally worse for performance and i wanted to argue one of the reasons why is cause of caching.
Which you can see with ECS for example. The philosophy here is to break objects apart, and focus on data oriented design. It's usually much faster in parallel, bulk-processing related workloads (e.g. here they saw up to 13x increase) in particular due to being cache friendly.
Now make the items much larger, and reference counted. Have multiple threads that are using the items concurrently without keeping the whole list locked (unless they are being added or removed). Also regularly remove items from arbitrary locations in the list.
That's the kind of situation that's common here, and where linked lists make sense. In addition, the linked list pointers are embedded in the object itself so this can be done without any additional allocations.
Actually, linked lists are generally less performant. In basically every situation.
In low level parallel code, such as might be found in a kernel, certain types of linked lists can be used by multiple threads at once. It's a core threading primitive, not a performance choice.
âŚso theyâre more performant in that context by way of atomic insertion and deletion lol
The point is that >90% of programs have no real reason to chase that level of optimization. A vector wrapped in a mutex is good enough in most contexts
Linked lists are common in kernel development because they process things sequentially like in a queue, predictable insert and delete, esp as you add pointers so you don't need to allocate memory
Haha. Perhaps we are using the work "complicated" differently.
If your list is needed for anything other than getting the next item, linked list operations are far more complicated than other data structures.
Sure, I _could_ implement a binary search with a linked list. But it would be complicated code. To the original point, Why do a complicated thing when a simple thing could do the trick? There are good reasons a lot of people never use linked lists in their real jobs.
That is not exactly true, but in practice is. With laziness you can construct them. But as soon as you want to modify, you would have to rebuild the entire list.
Technically, laziness is just hidden mutability :)
But you're right. Though I've never seen a good use case for doubly linked lists. I tried to build a trie recently with lazy upward pointers, but gave up and stuck a mutable var in there for the sake of performance.
I used one once for inputs. It was a low stakes project but I wanted to see it I could avoid the situation where one input always dominated the other (like how in many games one arrow key will win out regardless of which was pressed first).
I wanted priority to be with the last pressed key and if it was released, I wanted control returned to the next most recently pressed key that was still active.
The list never gets very big and the time scale involved means that things like cache misses are never really a concern, but it was the best fitting data structure I could think of and a fun little puzzle.
I had to implement once as a Jr đ It was a really cool project honestly where we set a asynchronous flow that is configurable in underwriting The linked list worked so well, we could set up what the rules were as a configuration, really dynamic and awesome honestly
Interviewing for a front end web dev position at Yahoo, one of the questions I got asked was, "if you were in charge of implementing hash maps in google's V8 JavaScript engine, how would you do it?"
Like, fucker, is that something I'm going to be doing as part of this job? No? Then why are you asking?
Sorry, it's exhausting. I not actually looking but I do keep up with the market and job postings and the requirements are just full out insanity. What job actually requires proficiency in C++ and Go and Kotlin and Coldfusion all at once?
The only linked list I've seen in 15 years was a suggestion from Claude Code. It's not really needed for that case so I told it to use a Queue instead.
It was only 20y ago where I was working on software built on doubly linked lists. Now that software was almost a 10y out of date at that time, but here we are. Modern language container constructs have all of this under the covers, you just don't need to know how it actually works.
Used a lot in C because you don't get any containers out of the box and no matter how good the greybeards are, they can't be arsed with DIYing a hashmap a lot of the time.
Yep. Even in cases where it seems like it would be the perfect data structure in theory, it's probably not. Potentially every step resulting in a cache miss will destroy your performance.
You can always tell what type of people youâre dealing with when the interview is about memorizing BS instead of a conversation. I care more about how you think than your proficiency in coding gymnastics.
Didn't have to write a single line of code for the interviews for my current job. All the jobs where i had to take code tests ended up rejecting me or ghosting me. But a talk with my future boss about coding did way more to show my skill than a toy problem that had nothing to do with the job.
I still believe that most software engineering jobs are not limited by the deepest, most complex technical solutions but by understanding the domain and having a reasonable understanding of system design (especially for a senior+ position).
Most companies are not at the edge of scalability, and a surprising number of people still barely optimize their DB indices when talking about vertical scaling of databases.
The software data packages for one of the latest models at my company is 20TB and it takes 48 hours to produce the probability distributions for a million locations on a 500 CPU cluster. Some of our clients are got early access and when they saw the spec sheet for hardware they all said "nope, OtherCorp has a model that is 100x smaller and 1000x faster and gives similar results"
I worked as a lead dev at OtherCorp. The secret to OtherCorp's performance is that we realized that you didn't need to store every single bit of simulation data and sweep through it for every location. When my bosses asked them for help, I proposed the concept and the response was "but we worked so hard producing all that data, we want to use it!"
A lot of data structures that linked lists could be used for tend to be implemented with dynamic arrays, circular arrays or other structures for performance reasons these days (e.g. queue/stack).
e.g. std::queue in C++ is backed by std::deque which is usually implemented as an array of pointers to memory blocks.
Ya that's fair, although queues and stacks, despite being similar to linked lists, are still a very different use case.
In my opinion, linked lists, like block chains or git commits, are intended to be more immutable, whereas stacks and queues are intended to be mutable and dynamic. Sure, you could still implement them as linked lists but that would be adding unnecessary complexity for nothing, even if that's what they end up being when memory is allocated. Long strings also end up being linked lists of sorts if their memory allocation is split across multiple addresses, but you would never consider strings to be linked lists.
Worst part for me in the job is figuring out how im going to communicate to my po, tech lead, qa engineer, and project manager why we need to add a column to table.
A doubly linked list is like the simplest data structure other than a plain array. Even if the job doesnât involve directly building custom data structures, if you canât answer questions about such a simple and ubiquitous concept then youâre just not a strong candidate.
Me studying physics, math, and computer engineering at accredited universities while also having a Masters in analytics, working FT through it all: well you see Bob here spent 3 months memorizing whiteboard problems, clearly he just is a stronger candidate.Â
I'm skipping DS&A because its too easy to use data structures appropriately when a situation arises. I'll take Discrete, Computer Architecture, Parallel Programming, Computational Game Theory.Â
If linked lists come up in these courses I'll learn them.Â
From what I can tell if you already have a lot of higher level math skills (I'm at the 300 level) and a working understanding of memory (pointers, references, and C-style arrays) and practical data structure experience, DS&A is actually somewhat trivial.Â
Computer Architecture II (if they let me skip level I) seems to be more suited to an actual intense systems background.Â
Thatâs sort of like saying a puzzle is simple. The rules are easy, you just put the matching parts together, but then you try putting together a 1000 piece picture of the sky and realize itâs a little more complicated.
I went through algo and work as a swe and I still donât fully understand red black trees and how they sort themselves, and dynamic programming still confuses the shit out of me. My data structures class was separate and it was fairly straight forward.
Iâd take the class, personally. It opened my eyes to the bottomless complexity you can build with just data and pointers.
How else can they test your knowledge in a short interview? It's not like they can spend 6 hours testing your knowledge (and I doubt you would like it)
For middle to senior roles? Sure, a good interviewer can understand your capabilities from a really short interview. For a junior role, especially with no previous credible experience? No way
It's middle level roles that Ive experienced the whiteboard onsite with a leetcode like problem requiring a specific implementation of a linked list in 2/4 interviews.Â
What can they do? I was a SWE at Google for 8 years. They absolutely can't test your knowledge and they don't care about it as all internal systems at Meta, Microsoft Google are custom so knowledge is not easy to test. They have run countless studies to try to figure out what is the best predictor of a success that can be measured during an interview. Yet they still do DSA questions that are very subjective.
Because none of those companies hire on credentials, they only hire on interview performance so you are right you have to make judgements based entirely on how they react to your arbitrary problems, which favor memorized solutions over critical thinking and more broad considerations.Â
On the other hand, if you hire based on credentials you should have little trouble gauging whether someone is who their resumes say they are within a few practical problems using only concepts they will need on the job. For example just by having someone do a left join on a primary and foreign key to eliminate records from a SQL table I can, within 5 minutes, determine if they are at least intermediate or not. Same with how comfortable they are discussing practical design patterns for software that include APIs, automated testing, database layer versus logic later, cloud infrastructure, etc.Â
Then if they answer my practical questions to the level commensurate with their credentials, I go back to the resume and hire the best one based on that with the interview performance no longer a consideration.Â
Did you just call a basic data structure a "white board problem" as if you're being asked to solve some Project Euler shit? If you truly think that, maybe that accredited university that gave you your masters needs to be audited...
A useless data structure for the job I will be doing*, but my MS was from a top 30 university thanks for asking. It's the advanced STEM I am taking in the CUNY system, which has a better program than most top universities, if you know how to navigate it.Â
I learned Classical Mechanics in a room with one other student and the professor. None of my other 200 or 300 level physics classes have had more than 10 students, and none of my other classes more than 25. And classes are very affordable, between $900-$1200 and you can take them at any campus (CUNY has 4 really good ones for STEM, but they specialize in different areas).Â
My program sends people to Harvard PhDs and the unemployment line. It's up to you to distinguish yourself between the two.Â
A linked list is not even complicated enough to be a âwhiteboard problemâ. Any competent programmer can throw together a halfass functional implementation of a linked list in like 15 minutes even if all they have is a 10 second description of it from the interviewer.
Pilots need to know a thing or two about the engines and electronics on their planes even though they never have to maintain them, because understanding how the thing works is important to correctly using it. In the same way, even if you never make a custom data structure, itâs important to know how they work.
For instance, can you name the benefits and drawbacks of a linked list compared to an array-backed list? Thatâs a genuinely important question with practical implications that I guarantee you will encounter in your career at some point, not a contrived theoretical question for an interview.
If it is such a trivial concept than using it to determine someone's programming ability is doubly stupid, but the real reason top tech companies use arbitrary tests is because they can't trust the person interviewing them to actually objectively rate the candidate's skills.b
I used to ask people to reverse an FLL straight out of college because it's an algorithm so simple that anybody who can write code should be able to do it in one go. Extra points if you can do it in one pass instead of two. I don't work for a super competitive tech company, so we didn't get top talent. Most people could solve the problem. Linked lists are elementary data structure and algorithm skills.
That makes them a great question to ask first years whose only experience is with the concepts they worked with at school. Terrible for actually experience employees who have practical knowledge of the work they will be required to do.Â
(I also have avoided DS&A and will just take a course in Discrete Math instead which has far wider application).Â
No offense to you, but it's a question to weed out people like you.
Yes, someone who has implemented a linked list for a data structure lecture recently can write it down in a minute. But if you say in an interview "Oh wow I haven't done that in a while, I'm gonna need a few minutes to make sure to handle the edge cases when inserting and deleting correctly", that will be totally fine too as long as they can see that you are able to work something reasonable out on your own.
The point is that a linked list is a struct or class with one or two pointers or references and the functions to manipulate them is basic enough that every programmer should be able to work out on their own even if they have never seen an implementation before. If you can't figure out how to allocate some memory and manipulate 2-4 pointers in the correct way, then what kind of programming can you really do?
Ah python. Then that question would basically check if you know how to use a class or a dict and that python generally uses object references for those. That's basically it.
If im interviewing you for a mid-level Python role and ask âwhat type of list implementation is used by default in Python, and under which circumstances might we want to use a different implementation?â , you come up completely blank, then I follow up with âitâs an array-backed list by default. What are the drawbacks?â and youâre still coming up blank, then I wouldnât consider you to be qualified for the job.
Id ask if there was most likely a less programmatic focused solution than maintaining such a large lists that the specific technical implementation in Python would matter, such as getting the data in chunks from the database.Â
First of all, you canât just choose to answer a different question than what I asked. Second, how do you know itâs from a database? What if weâre processing a bigass graph and we need something to function as a stack or queue â which data structure do you use then? This is a common question that comes up all the time in the math and physics heavy jobs youâre probably applying for.
Well why didn't you just ask that rather than asking me about a specific data structure in the abstract?Â
Even still i believe storing your queue in a database, such as local postgres, would be a better solution in Python than actually implementing a pythonic queue for performance. Let C++ based applications handle queues. Python is for business logic, at least in the backend.Â
I'm sorry, but if you can't answer my question, you probably aren't employable above an entry-level position, and I wouldn't want you on my team if you couldn't answer it. It's a terrible question for people with experience in the field, not because it's so impractical that nobody would learn it, but because it's far too easy of a problem.
So many people are outing themselves as not ready to work in industry. All of these "not used in the job" interview questions, are to establish a base level of understanding for a candidate. So that when the real work problems are being discussed, the team/manager know all the implicit knowledge expectations are there and don't have to be brought up, but they know they are considering, time and space complexity when discussing solutions. It (not) surprising how much of every technical problem comes down to, is it fast enough and how much memory does it use to do it.
Counterpoint: If these types of questions are supposed to demonstrate competency around performance optimization, why are most of these inevitably web dev jobs never asking questions about database performance?
In my experience, this is the far bigger bottle-neck in this field. Iâve seen some clever, highly optimized back-end code wrapped around some absolutely brain dead SQL queries that bottleneck performance a few orders of magnitude more than the back-end code ever could.
Optimizing database access and storage has mattered pretty much from day one when I started in the field and has never been covered in an interview to any reasonable extent. Mangling a string as efficiently as possible using the perfect combination of data structures does not demonstrate this knowledge.
Yeah, but the reason is because a huge amount of people claiming to be qualified for any given SWE job are straight up lying or over stating their skills and knowledge.
It's a "this is why we can't have nice things" situation.
so the solution is to ensure that your candidates can pass the hard questions on leetcode, rather than ensuring they can do the actual work that you're hiring them for?
Just hire people with university degrees then. There is no point to ask the same computer science questions from people with a diploma who studied the exact same thing for 4-5 years and passed all the related exams and graduated.
A huge chunk of modern CS majors will literally cheat their whole way through the degree. Cheating is so rampant in CS that I regularly meet people with CS degrees that can hardly code.
Will you ever have to implement a DLL in a high-level job? No! Will the default implementations of a dynamic array and a hash map from the standard lib work just fine 99% of time? Totally!
However, there would be that 1% of cases, where the customer would complain that the page takes 2 minutes to render or the disk scan takes 2 days to finish. And in these cases, you better understand how data structures that you use work.
I build in-house applications for verifying the conformity of our products to the standards we say they adhere to.
Inside every main thread is (at least) 2 other threads, one keeping the UI responsive and another getting shit done. And that worker thread is certainly spawning several others... my codebase is a real spaghetti messtern and while not all who async/await are lost, I sure am
I've had a multiple rounds of coding interviews where during Q&A time it came out that they are vibe coding everything now and they see that as the future.
Take the job, seriously. My company did this shift and this is the most fun I've ever had (well, if I wasn't burnt-out for other reasons). You cook your prompt so it can run in a single go with minimal input from you, then you can talk and laugh with your coworkers, browse Reddit, etc... for 15-30 minutes with zero shame as you ARE doing the work expected from you.
Imagine you cut all the triangles while jumping through loops and talking through it to show your reasoning interviewers. You've finally made it to the finish and then you have this lovely mail a few days after:
Hi <Disqualified Candidate Name>,
Thank you so much for the time you put into this process with us!
Taking into consideration your most recent interview, and other candidates who are currently in process, we have decided to move ahead with another person who we feel is a better fit for the Senior Fullstack Engineer role at the moment.
<Company name> is constantly growing and changing and we might open a new position that is a better fit for you soon, so stay tuned and keep checking out our career page.
We wish you the best of luck in finding your next opportunity and much success in the future!
319
u/Wentyliasz Oct 01 '26
It's not even that these questions are hard, most are genuinely a twenty minutes job top. It's having to do them on the spot while being judged for every line without the option of checking the docs, a set of conditions that will never show up in the real world
208
u/KoliManja Oct 01 '26
Every single time!
434
u/Mahler911 Oct 01 '26
I've been doing this shit for 26 years and I've never seen a linked list in production.
67
u/Akrymir Oct 01 '26
You can always tell what type of people youâre dealing with when the interview is about memorizing BS instead of a conversation. I care more about how you think than your proficiency in coding gymnastics.
24
u/actionerror Oct 01 '26
âHereâs our production Microsoft Accessâ
14
u/guardian87 Oct 01 '26
I still believe that most software engineering jobs are not limited by the deepest, most complex technical solutions but by understanding the domain and having a reasonable understanding of system design (especially for a senior+ position).
Most companies are not at the edge of scalability, and a surprising number of people still barely optimize their DB indices when talking about vertical scaling of databases.
11
u/Stormraughtz Oct 01 '26
"we're gonna need you to parse another CSV, this ones fun because there no qualifiers"
18
u/caiteha Oct 01 '26
My job has lots of low lvl stuff. I have written prefix tree / lots of tree stuff.
9
u/lraviel381 Oct 01 '26
Pretty sure there are plenty of libraries that handle linkedlists
4
u/LHW1812 Oct 01 '26
Not accurate; the second image should be the box thrown on the ground and stomped.
3
u/Abadabadon Oct 01 '26
Worst part for me in the job is figuring out how im going to communicate to my po, tech lead, qa engineer, and project manager why we need to add a column to table.
3
u/i_wear_green_pants Oct 01 '26
"Can you invert this binary tree"
Job is to create CRUD REST-endpoints.
20
u/EastboundClown Oct 01 '26
A doubly linked list is like the simplest data structure other than a plain array. Even if the job doesnât involve directly building custom data structures, if you canât answer questions about such a simple and ubiquitous concept then youâre just not a strong candidate.
7
u/Conscious_Penalty_36 Oct 01 '26
Yeah, but the reason is because a huge amount of people claiming to be qualified for any given SWE job are straight up lying or over stating their skills and knowledge.
It's a "this is why we can't have nice things" situation.
2
u/ToMorrowsEnd Oct 01 '26
Ok what about.... and hear me out...... TriplyLinkedLists?
2
u/zefciu Oct 01 '26
Will you ever have to implement a DLL in a high-level job? No!
Will the default implementations of a dynamic array and a hash map from the standard lib work just fine 99% of time? Totally!
However, there would be that 1% of cases, where the customer would complain that the page takes 2 minutes to render or the disk scan takes 2 days to finish. And in these cases, you better understand how data structures that you use work.
1
u/pipedreamSEA Oct 01 '26
I build in-house applications for verifying the conformity of our products to the standards we say they adhere to.
Inside every main thread is (at least) 2 other threads, one keeping the UI responsive and another getting shit done. And that worker thread is certainly spawning several others... my codebase is a real spaghetti messtern and while not all who async/await are lost, I sure am
1
u/updeshxp Oct 01 '26
Recently I saw Java Streams API in production code and was amazed as it's the first time I saw it being used commercially.
1
u/nahunk Oct 01 '26
Sierpinski.
1
u/br0ast Oct 01 '26
What even are these images?
1
u/notexecutive Oct 01 '26
it's so insane how true this is and it pisses me off.
Like sure maybe i'll have to think a little hard on some thing on the job but it's never as stressful or just algo-intensive as the fucking interview.
1
u/blahehblah Oct 01 '26
The job in 2026: "give me a triangle in a tin. Make no mistakes. Don't redo the rest of my triangles"
1
u/jaszkojaszko Oct 01 '26
If interview looks like this to you then someone else is taking care of the hard bits at your job.
1
u/ApprehensiveStand456 Oct 01 '26
I've had a multiple rounds of coding interviews where during Q&A time it came out that they are vibe coding everything now and they see that as the future.
1
u/InternationalBit2002 Oct 04 '26 edited Oct 04 '26
Imagine you cut all the triangles while jumping through loops and talking through it to show your reasoning interviewers. You've finally made it to the finish and then you have this lovely mail a few days after:
Hi <Disqualified Candidate Name>,
Thank you so much for the time you put into this process with us!
Taking into consideration your most recent interview, and other candidates who are currently in process, we have decided to move ahead with another person who we feel is a better fit for the Senior Fullstack Engineer role at the moment.
<Company name> is constantly growing and changing and we might open a new position that is a better fit for you soon, so stay tuned and keep checking out our career page.
We wish you the best of luck in finding your next opportunity and much success in the future!
The <Company name> Talent Team