1
dmonkey
4y

Some time ago in a telegram group a guy triggered me when he complained that "most students after the degree have no idea how to correctly implement the mean of a series of numbers".

Then he asked: "does anyone here know how to do it?"

Three people answered, including me, none gave the correct answer.
Eventually I got it, but now...

How many people here know how to implement the mean of a series?

Comments
  • 5
    SUM(items) / items.Length?

    I'm missing something?
  • 8
    Serious question: is this a serious question?
  • 2
    @craig939393
    I can only guess someone was playing stump the chump on cases where it's an evenly distributed ordered set in which case it is either the centerpoint for odd cardinality or the sum of the numbers at the floor and ceil of n/2 divided by 2. That's just a novelty though.
  • 2
    To be fair, they're not completely wrong. Interviewing university graduates at a Big Tech firm was like putting nails in my eyes.

    One candidate went something like this:

    ME: Okay so I have a problem solving question that you can solve in any language. Which would you prefer?

    THEM: Java is my main language

    ME: Okay great, so go ahead and get a hello world working and we'll go from there

    THEM: *stares blankly at their screen for a minute or so*

    ME: Can I help somehow? Tell me what you're thinking about

    THEM: I... don't know..

    ME: Okay so public static void main is what I mean, does that help?

    THEM: ...

    ME: Okay let's back up a bit, can you tell me what the public, static, void and main all mean?

    THEM: No sorry

    ME: No problem, let's just spend a few minutes talking about your personal projects then

    ---

    I was absolutely shocked. Did they not expect to... write code? To this day I still don't know how they passed the TPS. This wasn't an isolated case either, sadly.
  • 3
    @junon
    It's always been disappointing how few people can go from nothing. Starting vim and dumping a class and a main method into a file and passing it as an argument to jvm should be old hat, but it's file under "advanced wizardry" for whatever reason. Issue there is tools dependency. Most people doing java anymore rely on an IDE or spring Boot to give them a baseline. They know java as a framework. I doubt many of them ever configure javac or jvm settings directly.

    That said, I do get irritated when I get framework specific questions in any interview. That's a red flag for a shitty place to work. What those candidates train for is my personal hell.
  • 1
    I thought the same. Was this guy serious? Then he pointed two problems: overflows and the possibility that the sequence is infinte.

    I don't wanna play smartass, it took me some time to get it.
  • 0
    @SortOfTested totally agree
  • 2
    @dmonkey
    I'd say the original statement he made lacked context. Generally a series is considered to be reasonably finite in a given domain unless otherwise specified, to assume otherwise results in horribly de-optimized code. Even with a cumulative average, you will eventually overflow whatever buffer you're using.
  • 3
    I HATE trick questions in an interview. They test nothing and serve no purpose other than to weed out otherwise good practical candidates.
  • 3
    @dmonkey If the point is mathematical nitpicking, the mean of an infinite series can't be determined, not even approximated by looking at any finite number of members. What he's talking about is a rolling average, a stateful program that takes numbers as input and outputs the mean of each finite subseries as elements arrive. Very different from a mean function.
  • 0
    It’s brain dead to get the average of numbers in an array. But if an interviewer were to add a mathematical twist like that I’d tell the asshole to hire a mathematician! Obscure math wiz tricks for a development position? SMH (unless you’re hiring a programmer to write algorithms for mathematical research)
  • 2
    also different means are useful for different applications or so I heard.

    for example geometric mean is used in finance.

    https://towardsdatascience.com/on-a...
  • 2
    @d-fanelli If he had described it the way I did it would no longer be a math problem but a simple coding problem. The math part is thinking about the possibility of an infinite series when given such a task.
  • 3
    What complete nonsense by that other guy.

    Firstly, without context one can argue for whatever. E.g. - "who said the series of elements consists of numerical objects? Maybe I want to have the average over some CustomType, so you need to implement operators and some value function for CustomType first! Hahaha gotcha again, morons!"

    But secondly and more importantly - in the industry you code defensively, yes, but in a smart fashion. You don't just defend against everything and their dog, because
    * you waste your time
    * you waste computing time
    * you potentially mask errors by providing defaults
    * etc.
    so this guy doesn't seem to me like someone who is already working that job. /shrug
  • 2
    @Maer
    I think you just described telegram in a nutshell :)
  • 1
    @Maer I admit I pulled the conversation out of context. The elements were supposed to be numerical, and the guy is a phd right now and he's actually working on the field with a known competent professor (mostly app dev)

    @SortOfTested The group is a university group of our computer science departmento. We are computer scientists, not engineers, we mostly study theoretical stuff, so in order to be "correct" an algorithm must behave correctly in any situation, despite the implementation complexity.

    Sry for the misunderstanding and the lack of context, my fault. Still, in that context, he proved a good point.

    Btw I took notes from this discussion
Add Comment