DEV Community

loading...

Discussion on: I failed an interview because of an algorithm

Collapse
raulfdm profile image
Raul Melo Author

Couldn't agree more.

In these 5 years I had to solve some problems I couldn't find on the internet just because it was a company problem. I had to do a "glue" between Rails and Create React app which took me quite some time and I used a lot of scripting and algorithms but again, I composed the solution on top of a lot of existing things.

It's nice being able to understand the solution and why it's good for that but I think for 95% of devs we indeed does not need to know implement those things by heart without even search.

Good comment :)

Collapse
joelbonetr profile image
JoelBonetR

Thanks, a bit large on word count but I felt the need of adding all those info bunched together haha

As this comment received visibility I must specify that It's good to know the existence of different algorithms and the reason for them to exist, because you will be able to use them to solve real issues. My advice was for memorizing them without context or further acknowledgement about this algorithms.

Most of them are meant to solve specific needs on a given field. I mean if i like to work as developer on a NASA project I must learn and know some basics to benefit the effectiveness of sharing information between departments but at the end, the professionals of a given field will give me the calculus to implement and I'll be a bridge between this scientific and the computer/machines, I don't really need to know or understand all the implicit science about something to implement a given algorithm on a method.

Cheers! :)

Collapse
luiz0x29a profile image
Real AI

Being able to understand the problem is what matters, he failed at that when he tried to sort by the length, the problem was sorting by the version.
You don't need to know algorithms or fibonnaci, but they teach fibonnaci so you learn how to use recursion to solve problems. And they teach you to make BubbleSort so you learn how to use any sorting algorithm. They need a comparator, you can easily get it if you implement the simplest algorithm.
You will never need to write a bubblesort algorithm in the real job, but the less in solving problem is an useful one.
(unless you work in the browser team, then you need to know algorithms like quicksort from the hearth)

Thread Thread
joelbonetr profile image
JoelBonetR

Sorry but i knew (and being trained) about recursion time before being asked for Fibonacci at college, applying this algorithm is only a way to implement it on a specific way.

Moreover the tech tests when applying for jobs are the same for juniors than for seniors on most companies which is a bit weird, don't you think so?

By the way if you want to know if someone can apply recursion or whatever you could ask for a real use case instead on pretending people to memorize algorithms, remember than on most interviews you cannot google anything (which also it's a bad practice and poor realistic, if i hire someone I like to see people are able to search properly and how each person handles the information they found, which is more important than being memorised things)

Thread Thread
luiz0x29a profile image
Real AI

We can argue all about Fibonacci being a bad way to teach recursion. The thing is that it is not useless because you don't use it in the real work.
Its just a teaching tool, its not even a good one, not everything should have a purpose of directly being used at work.

I do agree that those interview tests are kind of useless. I would fail a person based on how they try to solve a problem, and how they grasps it, not solely on remembering trivia.

Memorizing algorithms is useless, you do have to implement then at least one time just to grasp how to use it, unless you're super-intelligent and come up with bubble sort on you own, as I did.
I implemented the B-tree record exclusion in a exam in the University without ever implementing any of the B-tree insertion before, just from reading the textbook, it was not even memory, I just looked at the data structure and I saw what I needed to do to it, but then I had 5 years of experience as developer.
I could invert binary trees by head, this would be easy.
I wouldn't expect any candidate to do that. Also, I'm a Research Engineer, not a web developer. I still do need to interview them for my projects that have frontend, I don't expect them to know CS thingies.

But I do expect someone with that many years doing JS to know that sort takes a comparator. Massaging data is basically what a programmer does, sorting included, you don't need to come up with sorting algorithms, but you do need to know how to use them.

Also, I do agree that not being able to google the solution is a bad thing.
I would let him search for the solution, as long as he said to me that the problem was "sorting by the version". Instead of just trying to come-up with random algorithm.

Thread Thread
luiz0x29a profile image
Real AI

Just to clarify, I don't like doing those tests on people. I like to leave them a problem in open scope and then see the result of what they can do.

Thread Thread
joelbonetr profile image
JoelBonetR

So we agree on most things, there's no much point on repeating the same things all over again. Of course we're talking about web development (if I didn't catch bad the OP). We could even being talking about whatever field of development process and target (which could be insane).

Glad to see you are a theoretical learner, that's nice, each one have our own way to learn things, mine is mainly pragmatic (i usually put my hands on and let the theory for later), others are reflective and so... (I just published a post about that this morning, you can find it on my profile).

All this is about the precision of job interviews on our matters, IT is a science which it's job doors are handled by human resources people, who obviously knows nothing about. Then I even found companies on which tech interviews are handled by IT department and are even worse than those handled by human resources, because HR people at least look (or should) for abilities and behavior on each individual while some IT people that performs this tasks have zero idea about and mostly have no motivation for it.

A change is taking place on this thanks to internet and some companies experience but TBH I've seen continents moving faster than the evolution of IT interviews 😅

Thread Thread
joelbonetr profile image
JoelBonetR

Yes i catch your point of view and i also read your answer to the sorting issue (converting into string is a bit tricky here, you'll need to change dots for a value that makes 3.10 sort as bigger than 3.3.3)

Another solution could be split this data into a matrix and assume weight for each array position decreasingly, then you sort each array inside the matrix by it's weight value.

There are some valid solutions i figure out for that problem but well, it's all about practice. I've been commenting here to show a bit of hate about IT interviews (I've to do so once a month for keep breathing 😂) but the OP's tech interview is not that bad, he needs a bit of practice and he'll make it for sure.

Thread Thread
luiz0x29a profile image
Real AI

I only suggested that because some beginners seem to have it easier when working with strings, I would allow that as a solution to the interview, If I was obligated to do one.
I remember solving this once with a format, but the language already did the tricking "masking" on the "." dots to me. (I think it was VBA, lol, I used to work on that)
The weight solution would be more correct as working with strings is kind of bad for performance usually.
And its really all about practice, and you can't disqualify people because based on failing such a trivia if they create good code in the end. Those things won't pass code review anyway (or you company has other problems, and tech interview is one of those). Those are the sort of things that more people working together always get a better solution, because everyone know a bit of different trivia.

Thread Thread
joelbonetr profile image
JoelBonetR

I started with an HTML course using windows notepad when I was 14, the first backend language i used was ASP Classic (which was not too different from nowadays trendy python after all 😂)

Whatever language gives you skills :)

And yes, all companies have issues with IT, specially due to the fact you need to adapt IT to the company but also the company must adapt it's processes for being more efficient and effective while using IT, and most of them only wants IT to adapt things to the way business is driven.
Also the change factor it's important, there are companies hiring junior devs to cut costs and asking them for big products where they have no experience, then you got a poor result of course. I've been coding professionally since almost 11 years and I even could be scared if I had to manage a whole big product for a company with no IT background (learn about the business, understand the needs of each part, pick requirements, deep analysis, define the project architecture, organize the team, break the project into tasks and milestones, guess the timings for each task, prepare the server and the repo, add CI/CD, make a readme, set agile cycles, start coding and pray for all to be ok on each milestone and for the Requirements to remain same as were on the beginning and that if there's any change that this changes don't make your initial architecture and design useless so you need to patch it how you can or rebuild some parts of the already coded app).

I'm tired after thinking on that all but excited for doing it again too 😂 it's a love-hate relationship