Welcome to Incremental Social! Learn more about this project here!
Check out lemmyverse to find more communities to join from here!

Naich ,
@Naich@lemmings.world avatar

Want to print out all odd numbers from 1 to 100? Easy:

for(_=[];_<+!![]+""+[]*[]+[]*[];_++)(_%+(!![]+!![])?console.log(_):[]);

Naich ,
@Naich@lemmings.world avatar

Actually, I prefer this one:
for(_=[];_<+!![]+""+[]*[]+[]*[];_++%+(!![]+!![])?[]:console.log(_));

Naich ,
@Naich@lemmings.world avatar

Or this one without the "undefined" when run in a browser console:

for(_=[];_<+!![]+""+[]*[]+[]*[]-!![]-!![];_++%+(!![]+!![])?[]:console.log(_));_+!![]

boredsquirrel ,

Wtf people, can somebody explain?

Naich ,
@Naich@lemmings.world avatar

_ is a variable name, [] becomes 0 when converted to an integer, !![] becomes 1. The + "" + means that the integers 1, 0, 0 get converted to a string - "100", which gets converted back to an integer because it's in the for loop. And there's various other horrible conversions going on to make it all work.

blind3rdeye ,

I don't believe these are genuine interview answers.

RubberElectrons ,
@RubberElectrons@lemmy.world avatar

I hope not...

tallricefarmer ,
@tallricefarmer@sopuli.xyz avatar

They do seem to be a bit absurd. I had a nice chuckle though.

letsgo ,

The previous candidate to me at a job a few years ago left the room in tears after not being able to write Fizzbuzz. On a laptop with Visual Studio installed, on their own in a an empty room with nobody looking over their shoulders. The same company said they'd had so many candidate, including university graduates, who simply couldn't code, that they were almost giving up on it.

ICastFist ,
@ICastFist@programming.dev avatar

Suddenly I feel like a fucking accomplished programmer, despite only doing some questionable stuff on Godot lately, but never messing up my loops... Not too badly anymore, anyway.

A fizzbuzz type of question I know I would mess up on the modulo operator. I know the logic is if the division of the current_number by 3 has a remainder of zero, write fizz, but I always look up the operator

letsgo ,

Yeah it always feels like "negative logic" to me. If it's not this and not that then don't do the other... Does my head in. Next time I'm going to use a lookup table "x..f.bf..fb.f.." then mod15 the index. f=Fizz, b=Buzz, x=both. Nice thing about this is that it's easier to change with the requirements. Want to shift the second fizz right one? No problem "x..f.b.f.fb.f..". Good luck doing that with the standard approach. Add Gronk which collides with Fizz, Buzz or both at various times? Also no problem - just extend and modify the LUT accordingly and change the mod.

I can already hear people asking why x is at the start. Arrays are indexed from 0. FizzBuzz starts at 1. 15 mod 15 is zero. Loop N from 1-100, switch on lookup[N%15], case 'f' print Fizz, case 'g' print Gronk, case 'p' print FizzGronk and so on. The only "nice" original feature you lose is when both %3 and %5 fire at the same time and it prints FizzBuzz without any extra code.

gjoel ,

Same, fizzbuzz was one of our tests. Nearly everyone messed it up. The telling part was how. We had a guy with 20 years of experience who demanded ample compensation write code that not only didn't compile, but it made little sense. A lot of people were pretty good bullshitters - then after the test they went "Yeah, well... That went bad huh?". We had a different, more difficult test that people could choose. We had one guy who did somewhat poorly on that... But asked to take the assignment home for his own sake. He was a very god hire. Not because he worked overtime or anything but because he cared.

PolarisFx ,
@PolarisFx@lemmy.dbzer0.com avatar

Oh geez, I'm one of those people who can't code on paper. I was applying for something ages ago and I went in for a programming test and they handed me a paper test and my mind completely shut down. Put me in front a computer and I have no issues at all... It was embarrassing.

kuneho ,
@kuneho@lemmy.world avatar

for some reason I still needed to know programming on paper so much so that at the university, in class prgramming we had to do the exam on paper. every time. no matter if it was Java or C++...

I strangely enjoyed it, but it still was kinda weird.

PolarisFx ,
@PolarisFx@lemmy.dbzer0.com avatar

I lucked out, my university was digital before that was a thing. So the amount of written exams was minor enough that I pulled through ok

uis ,
@uis@lemm.ee avatar

In university I written on papers programs in pure C. They did compile. They even worked. But they were school olympiad-level, so it doesn't count I guess.

Oh, and I was supposed to write in Python.

jkrtn ,

Even the odd numbers stuff? I think interviewers account for nerves and being outside an IDE. You might draw a blank but would you be would be randomly adding things like these did?

PolarisFx ,
@PolarisFx@lemmy.dbzer0.com avatar

No this was just crazy, I have worked with people like that though where stackoverflow was permanently on a second monitor, and I wondered how they made it through the interview process

mipadaitu ,

I would just write down the steps I would take, just some psudocode. It doesn't have to work, it just has to make sense in the style of the language you're talking about.

import random library  
import any GUI/display libraries required for the outcome desired

build array of integers [1..52] (or 0..51 if you're being fancy)
for loop 1..1000
       select random number A 1..52 (or 0..51 if you used that above)
       select random number B 1..52 (or 0..51 if you used that above)
       swap elements in the array A and B
pop first two elements from array
decode at display time what the two numbers represent in terms of playing cards

If the test requires more than that, then they're crazy. The syntax doesn't matter, just that you can logic yourself through the problem.
You can use the IDE, google, or whatever to fill in the specifics. If you wanted me to do that in literally any programming language, once the psudocode is done, you just spend an hour or so looking up the details.

renzev ,

If you wanted me to do that in literally any programming language, once the psudocode is done, you just spend an hour or so looking up the details.

In some cases, you can even use an AI chatbot as a "pseudocode compiler". Just tell it to translate your pseudocode to an actual language. I've done it for shell scripts a couple of times, works surprisingly well. Not that I would do this at a job interview haha.

germanatlas ,
@germanatlas@lemmy.blahaj.zone avatar

Yeah, I really liked my prof for some of the programming courses, but also damn him for making us write code on paper in the exams

wfh , (edited )
@wfh@lemm.ee avatar

And that's why we're moving away from coding games where I work. Bad people try to cheat, good people can panic and shit the bed.

When I do interviews, I'm more interested in the candidate's relevant experience, what kind of issues they faced, how they were solved, if they think they could have done things differently, and how they think. Code itself is irrelevant unless I can review a sprint's worth of PRs.

When I ask more technical questions, I never ask for code but for an explanation on how they would tackle the problem. For example, I often ask about finding a simple solution to get all data relevant to a certain date in two, simple, historized tables. If you know window functions, it's trivial. If you don't, your solution will be slow and dirty and painful. But as most devs don't know about window functions anyway, it lets me see how they approach the issue and if they understand what parts should have a trivial solution to make it simple.

Veraxus ,

This is why I prefer live interviews. I tell them they can use whatever tools they want, search for anything they want, there are no restrictions. All I ask is that they share their entire screen (if not in person) and try to "think out loud" as much as possible. I then time-box each step (usually 15m ea in a 1-hour interview).

I am most interested in HOW they solve the challenges I set out for them. Whether they complete it or not is usually irrelevant.

Edit: Lately, though - I warn against AI. I don't ban it, but every person that has tried to use AI in an interview has gone down in flames. AI simply cannot be trusted... and if you haven't learned that lesson, and you can't even tell when it's giving you bad information... yikes.

blackbirdbiryani ,

Man live coding interviews sound like a nightmare to me.

BeautifulMind ,
@BeautifulMind@lemmy.world avatar

It's not so bad once you've got your teeth into the problem

assuming you can code, that is

hangonasecond ,

Can I interview with you lol - this sounds great!

0xD ,

I approach interviews for penetration testing positions in the same way, just with hacking challenges!

ErilElidor ,

I use ChatGPT sometimes to give me a pointer in what directions I could go/research more for a given problem. But if I ever take the code provided by it, I need to review it line by line and half the time it doesn't even compile anyway. At this point it's just a helper to suggest to me what to google for and then I do the rest😅

Asudox ,
@Asudox@lemmy.world avatar

"Y'all wanted good documentation, no?"

phoenixz ,

Ooohhh, OP is shitting on PHP, how very original!

Maybe next time, though, OP should read what OP posts before OO writes a title, as the content has nothing to do with PHP, its all sorts of languages (none of which PHP) and mostly javascript.

The content is pretty on point in general though, I've had the unfortunate luck of having dozens of developer candidates like that.

uis ,
@uis@lemm.ee avatar

I don't see shitting on PHP by OP.

Also PHP is shit. Just so you won't be disappointed.

phoenixz ,

Then read the title.

And oohh yeah, PHP sucks because everyone else says so and a blog post of 20 years ago said so too? That literally was the last argument I heard against PHP.

It's becoming tiresome

uis ,
@uis@lemm.ee avatar

I think we read different titles. Mine doesn't shit on PHP.

phoenixz ,

Mine reads "code interviews for a php developer role", which with the image implies that all php developers are incompetent because they use PHP.

germanatlas ,
@germanatlas@lemmy.blahaj.zone avatar

This makes me feel bad for the candidates but gave me the confidence boost I need right now

Socsa ,

You can tell this is fake because the code interview actually tests basic knowledge instead of giving you 13 minutes to create a templated polymorphic class which accepts arbitrary flatbuffer arguments and implements factory pattern constructors written in Haskell, with the end goal of recursively sorting nanoparticles by bond strength. Intro level position, $8/hr, must supply your own MacBook.

uis ,
@uis@lemm.ee avatar

Ewwwww, macbook. Oh, wait. It was sarcasm I guess.

VantaBrandon ,

I once knew a "developer" with 20 years of "experience" who could not write a foreach loop by hand

Some people are really good at bullshitting their way through life

JareeZy ,

Knowing about and having met multiple such "senior Devs" has made me feel so much better about my work and my own set of skills, not gonna lie.

sunbytes ,

I jump between languages so much I can never remember the structure.

for item in items? Or item of items or items as item?

Best to just have the IDE auto complete it.

PsychedSy ,

Same here. I'm blue collar so I only do it at work if someone fucks up and gives me access to an interpreter. Or I suck it up and use powershell or excel then drink vodka and cut myself when I get home.

KingOfTheCouch ,

Holy fuck that last one was literally me in my first interview fresh out of college. Full on panic attack.

0xD ,

Only PHP programmers post something like this as an image! 😘

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linuxmemes@lemmy.world
  • random
  • incremental_games
  • meta
  • All magazines