News for hackers. Stuff that matters.
Re:What to do if you get a question you've already seen in a... by dhsysusbsjsi on Saturday January 29, 2022 @01:50AM (#30124351)
(Small business owner): I prefer the "write me a function that squares a number" approach as the big filter. If they cannot do it, stop right there. If they write it and struggle a bit, stop there. If they write it at a normal or fast speed, continue. If they write an inlinable generic function that accepts anything that can be multiplied - things are looking really good.
Re:What to do if you get a question you've already seen in a... by romanhn on Saturday January 29, 2022 @01:54AM (#30124367)
Interesting. My signal from a generic function is that this person tends to overarchitect, if my request was about squaring numbers specifically.
Re:What to do if you get a question you've already seen in a... by nurettin on Saturday January 29, 2022 @02:16AM (#30124465)
You can actually train these people by making them create quick POC projects until they become practical programmers. I would take the overarchitechting person.
Re:What to do if you get a question you've already seen in a... by exac on Saturday January 29, 2022 @02:00AM (#30124406)
Some people love asking interview questions where they don't state all the requirements, so I suppose the idea is to see if the candidate can discover the "hidden criteria".

This also makes more sense in a language where number types need manual casting.

Re:What to do if you get a question you've already seen in a... by xmprt on Saturday January 29, 2022 @02:38AM (#30124555)
If I heard this question, I'd be more confused than anything. The answer seems like it's just return x*x but I'd probably be more interested in why squaring numbers is so important that it needs a special function. Maybe I'm supposed to implement a BigInteger class or something like it...
Re:What to do if you get a question you've already seen in a... by Jare on Saturday January 29, 2022 @02:58AM (#30124639)
> why squaring numbers is so important that it needs a special function

I've had pow2() in pretty much every codebase I'd worked on, ever. pow2(x1-x0) looks nicer and less error prone than (x1-x0)*(x1-x0), and less verbose and distracting than first separating to a local var as dx = x1-x0

Re:What to do if you get a question you've already seen in a... by toxik on Saturday January 29, 2022 @03:01AM (#30124652)
What about using an actual vector library like Eigen? I wouldn’t dream of reimplementing basic maths like that.
Re:What to do if you get a question you've already seen in a... by jstx1 on Saturday January 29, 2022 @05:01AM (#30125169)
Okay, let's role play this. Here's my Python solution:

    def square(n):
        return n**2
As a well prepared candidate, it took me seconds to write this. What did this tell you about me? Did I do anything wrong and if yes, what did you expect to see instead? What does this score out of 10 and why?
Re:What to do if you get a question you've already seen in a... by praptak on Saturday January 29, 2022 @03:09AM (#30124686)
You are almost certainly better off just writing x*x whenever you need a square. A good programmer would point this out.