• Tartas1995
    link
    fedilink
    arrow-up
    28
    arrow-down
    1
    ·
    2 months ago

    I hope these aren’t real. I, and most people here, could probably write these codes top to bottom on paper without an eraser or strikethrough parts because we have it fully solved before the interviewer finished the sentence.

    • sntx@lemm.ee
      link
      fedilink
      arrow-up
      7
      ·
      2 months ago

      I mean, it’s a hard problem to solve if you never worked with moduli before.

      • themusicman@lemmy.world
        link
        fedilink
        arrow-up
        24
        ·
        2 months ago

        Sure, programming is hard if you’ve never worked with programming language features before… Modulus isn’t some obscure esoteric operator, it’s literally CS 101

        • drphungky@lemmy.world
          link
          fedilink
          English
          arrow-up
          4
          ·
          edit-2
          2 months ago

          I fell backwards into programming and did it for years before ever needing or encountering a mod operator. It never really came up in statistical programming (SAS) and since I wasn’t a CS major I don’t think I even learned about it until taking online programming classes for fun. But I know I was a pretty damn good SAS programmer. I never had any issues solving any problems in my field programmatically, but I took a few leet code tests and was completely puzzled before taking said CS classes. The algorithms and common problems just never remotely came up. I never found fizzbuzz particularly relevant in statistics and data CRUD.

          Now maybe since SAS is procedural and not OO you’d say it doesn’t have typical “programming language features”, but I could easily see that experience being common in all kinda of business side programming like R, VBA, maybe JavaScript or Python, etc.

          …but anyway obviously I’m not saying its not a good thing for a dev shop to interview on, and if they want someone classically trained then it’s probably a perfect question. My quibble is just that you might need to widen your definition of who programs.

      • hope@lemmy.world
        link
        fedilink
        arrow-up
        9
        ·
        2 months ago

        Is it? I would expect someone to come up with either toggling a variable back and forth for even/odd, or counting by 2s, heck, treat it as a floating point, divide by two, and search the string representation for a period or something!

        • sntx@lemm.ee
          link
          fedilink
          arrow-up
          1
          ·
          2 months ago

          I feel like the floating point suggestion would backfire quickly due to imprecisions.

      • jkrtn@lemmy.ml
        link
        fedilink
        arrow-up
        8
        ·
        2 months ago

        Shouldn’t people familiar with integer arithmetic should be able to struggle to something like x == 2 * (x/2) to test if it is odd or even? Or just bitwise x & 1?

      • uis@lemm.ee
        link
        fedilink
        arrow-up
        3
        ·
        2 months ago

        Meanwhile I in school practiced Diffie-Hellman on paper with classmates