DEV Community

Discussion on: I failed an interview because of an algorithm

 
luiz0x29a profile image
Real AI

Except no one asked to work on binary trees, the browser does that and provides the DOM for you to use.
He failed because he didn't knew that sort accepted comparators.
You don't need to know quicksort and CS stuff, but knowing that sort has a comparator input is essential to being a programmer.
Every language that ever has a sort will have an input for a comparator so you can sort "by radix" or anything else.
He failed because of the way the approached the problem, randomly trying to throw things at the wall to see if the stick is bad way of solving the problem.
Even, if one of my candidates correctly identified the problem as "sorting by the version parts", he would pass the test even with wrong/incorrect code.
Knowing how to solve problems is the thing.

Thread Thread
 
phantas0s profile image
Matthieu Cneude • Edited

I don't believe that "you need to know X to be a programmer". Because everybody has its little X, it makes the interview tests a bit like a Russian roulette.

What I believe is you need to be able to adapt, to learn and to be ready to dive into a business domain to be a good developer. The knowledge you have now will be deprecated at one point anyway.

He failed because of the way the approached the problem, randomly trying to throw things at the wall to see if the stick is bad way of solving the problem.

And maybe he did that simply because he was doing an interview. Maybe his coworker could have helped him quickly if it was a normal working day. Maybe he would have searched on Internet and find the correct answers. Maybe he could have learn from his mistake, grow, and increase his value for the company.

Context matters.

Thread Thread
 
luiz0x29a profile image
Real AI • Edited

I don't believe that "you need to know X to be a programmer".
No, to be a programmer you don't need to know X, but if you say you know JS, then knowing Array.sort and how to use it is pretty much a given.

Context is precisely the problem. Interviews are a totally artificial context.
The probably just did random things because of the interview, the time limit, that's not how you approach any problem.

Ironically that's how lots of bad companies work, so by doing some interview like that you get to know that they can't manage and only work on time pressure, not on results.

Also, base knowledge like sorting is so commom and basic to being a programer, it will never become obsolete. Javascript will, but all programming languages (given the same paradigm) will have some way or another to sort things.

So I do disagree that you don't need to "know X" to be a programmer. Its like saying a plumber don't need to know any "X", X being pipey thingies.

You don't need to know trivia about the language. JS has a lot of quirks, but you do need to have some foundations in programming, sorting is one of those.
We do have to have some standard of cut, that's the entire purpose of the interview, its just a "search problem" , I do concur that some processes are stupid, like whiteboarding.
No, its not a russian roulette, because there's all the other "human" aspects, not everything should be about programming.

Thread Thread
 
luiz0x29a profile image
Real AI

Actually in some cases you don't need to know "X", if you are doing SQL, for example, or Prolog. Sorting is done by the tool, you do need to know relational algebra in case of SQL, or propositional logic and unification in case of Prolog.
I'll all depend on the context of what's being done, of course.

But sorting is a basic thing a programmer need to know (at least how to use it), its together with things like conditionals and looping/recursion.