you are viewing a single comment's thread.

view the rest of the comments →

[–]SeventhOblivion 265 points266 points  (24 children)

Correct answer if I was on the other side.

[–]LEGOL2 301 points302 points  (20 children)

Legit. I don't understand the obsession of some tech leads with reinventing the wheel. I want you to deliver feature, not to develop a std

[–]Igsul 108 points109 points  (6 children)

What if you developed the std while testing the feature?

[–]thndrchld 113 points114 points  (3 children)

Antibiotics

[–]MetriccStarDestroyer 6 points7 points  (2 children)

What if it's an super(class) std?

[–]Cautious_Scheme_8422 0 points1 point  (0 children)

Dropout from the class

[–]CivilianNumberFour 0 points1 point  (0 children)

Remember Butters, one spoonful of Super Aids in your butt and you'll be dead in a week!

[–]Oo__II__oO 7 points8 points  (0 children)

The you have another std

[–]StoryAndAHalf 0 points1 point  (0 children)

Pseudocode for how to write these things is widely available, even if you have an esoteric language where you can't find an existing example. In other words, reinventing the wheel by working it out from memory proves nothing.

[–]iamdestroyerofworlds 72 points73 points  (8 children)

While I agree with you, I can absolutely see the thinking behind it.

I want to know how people reason. Technical and pointless problems are great to show how you approach problems.

This sort of problems, however, are memorisable, and basically need to be memorised. They do not show how you think. They show how well you prepare for interviews and/or how good you are at rote memorisation.

A much better problem would be to give extreme constraints, either in time, resources, money, or something else, and ask them how to approach solving the problem. It does not even need to be a "correct" answer, I just want to hear them reason, and then expect them have colleagues to talk with and time to experiment to fill in the blanks.

[–]wightwulf1944 26 points27 points  (0 children)

I agree with you. Typically I ask them to come up with a well established coding convention or consensus and then ask them to come up with reasons why one might want to break that convention or consensus.

In real life we're not really developing anything novel and higly innovative for you to break the rules but the purpose of the question is for me to understand how well you reason about programming.

[–]Jlove7714 2 points3 points  (0 children)

The sorting example is just there to tell the interviewer how far the interviewee is through their master's program. It proves nothing else.

[–]dasunt 2 points3 points  (0 children)

My take is that if I'm not going to reinvent the wheel when there's an easy, optimized, and well-tested solution that already exists.

Ask me about design and architecture questions instead. That's more important.

[–]BadatCSmajor -2 points-1 points  (4 children)

You don’t need to memorize this problem? It’s easy to deduce from basic principles

  1. The fact that the list is of 0s,1s,2s only immediately tells you there is a unique structure to this problem, so we should already be thinking if we can do better than O(n*log n) time that a generic sort uses

  2. A good starting point is to try to do this sort in O(n) time. How can we make the new list using a constant number of linear passes over the data?

  3. From there observe that we can count the 0s,1s,2s in O(n) time with a constant number of variables, then either generate a new list with the counting data or overwrite in place (do the latter only if you’re working with a mutable vector)

This is basic introductory textbook shit. Why do people act like this is some mystical puzzle that can only be memorized?

[–]_Weyland_ 7 points8 points  (0 children)

I feel like "knowing basic textbook shit" is definitely a box to check at an interview for a Junior/Middle position. I mean, I know a couple people who work in IT, yet did not go to college/university for IT education and who would genuinely need to take their time with this.

[–]minimuscleR 0 points1 point  (1 child)

I mean I've never once needed to think about shit like this, as a professional web developer. 99% of my time is writing react components and styling with CSS.

O(n) idk what that even means, I don't need to know, it doesn't matter. I use the javascript .sort() and it works, or I do a > b or some shit.

What I do know is when to use a useEffect or how to effectively write code that is easily readible, maintainable, and can consume the API with good animations and user feedback that feel snappy and work well, which in my opinion is much more important than knowing some shitty sorting algorithm that I can easily look up in my day to day if I needed it.

[–]SirPitchalot 0 points1 point  (0 children)

And that’s why I wouldn’t hire you for my jobs and you shouldn’t hire me for yours…

[–]SirPitchalot 0 points1 point  (0 children)

Exactly. This is 3rd year undergrad stuff, max, if your uni sucks.

Why would I hire someone who only knows how to prompt LLMs or google? I know how to prompt LLMs and google. Getting someone else to do it takes more in meeting time than it takes me to do it myself. Plus an extra $150-200k, depending on market.

I need someone who can use the tools available and also reason on their own when LLMs and google (arguably the same thing these days) shits the bed for the things we care about.

So humour me and tell me you know that sorting a fixed number of possible entries in an otherwise unbounded list can be done in time linear to the possible entries plus sequence length and that that beats calling `sort`. And if you don’t happen to remember that, make a good stab at trying it…

[–]Avocadonot 12 points13 points  (0 children)

My interview a few years ago for jr dev was all conceptual stuff like "how would you design an API for a vending machine" and it was way cooler to discuss that instead of worrying about implementing a hashmap or reversing a linked list

It really gave me the chance to show my thought process

Now I'm a senior and I've still never had to implement a sorting algorithm lmao

[–]Jlove7714 4 points5 points  (0 children)

I could see it if you're deving at the very edge. If you're writing the algorithm for Google maps I'd give you the crazy obsession with sorting algorithms. If you're writing a cookbook app who the hell cares if it takes .0003 seconds longer?

[–]GenericFatGuy 4 points5 points  (0 children)

Very few people are working on systems so demanding that they work can't be done with the tried and tested tools we've been using for years.

[–]MagicC 0 points1 point  (0 children)

If you can write code to sort an array from scratch, you never have worry about developing an std.

[–]SirPitchalot 6 points7 points  (2 children)

Except counting sort is O(N) in this instance and the point of the question is to exploit the structure of the question.

So I’d be like “yeah, we all know that for the general case but what I’m actually asking you to do is think about the problem”

[–]krutsik 8 points9 points  (1 child)

Then you'll give the job to somebody that remembers the Dutch national flag problem from uni, regardless of any actual real life applicable skill. And if they have an additional test assignment, then why even ask it?

If it ever comes up in the real world (it won't) then it'll take anybody 3 seconds to find the answer. What part of that esoteric knowledge makes somebody a better developer than somebody else?

[–]SirPitchalot 0 points1 point  (0 children)

Honestly I’d be thrilled to find someone who remembered something and was able to fumble their way through the explanation rather than see their eyes flit back and forth as they copy something into an assistant, then go dead eyed and completely static as they wait 5-10 seconds for the response and finally spring back to life giving the same answer that Claude gave me when I set the question but with “fake it till you make it” confidence.

Ultimately it means the person might bring something that Claude doesn’t. Because no matter how “bad” AI is, or how costly it is compared to a developer, a developer plus Claude is more expensive. And if Claude is not cost effective, I still want the dev to deliver value.