The second time I interviewed at Google I was asked to write a linked list from scratch. I was expecting something a little more “difficult” and thought I would breeze through the question. I had been studying for months for this interview, after all, so this should be easy… right?
It didn’t take long before I completely locked up. The logic for inserting and removing was wild… and then I was asked to reverse the linked list, another ridiculous and annoying question.
And yet I couldn’t do it on the first try.
I failed that interview, which was humiliating. I had 15 years of experience and I couldn’t reverse a linked list?
I know I’m not the only one to get blindsided by a basic question like this. Turns out, this is a tactic used by a lot of interviewers when interviewing senior people: ask a basic question and see how they handle it. A friend of mine does this kind of thing routinely for a larger tech company. Their thinking is straightforward: if you get grumpy when asked to do something simple or “beneath you”, you might not be the best candidate.
I can see the logic in that.
That’s what today’s video is all about: doing the very basics with a Linked List. Hope you enjoy! If you want to play along, here is some code to get you started:
//This is the simplest possible linked list
class Node{
constructor(val){
this.value = val;
this.next = null;
}
append(val){
this.next = new Node(val);
return this.next;
}
}
Learning Elixir changed me as a programmer, and learning functional concepts changed the way I think about writing software. How about you? Is functional proogramming a useful thing to learn?
I've been using Ghost for many years and recently I decided to see just how far I could push it.
Lots happening here, so here’s an update.