If it is a "toy" question, then I'm of two minds about it:
On one hand, I am used to solving higher level problems, so it might take me a few minutes just to realize you are asking a much simpler question. It also can feel just a tad insulting to be drilled on CompSci 101 questions.
Oh the other hand, I think candidates should be able to solve such questions, as long as the scope is clear. You need to filter somehow and I've met people who could not do that.
The solution is a while-loop with a couple of if-statements. I would hope an engineer would write code like this many times per day. Whenever they need to marshal a blob from A to B.
> It also can feel just a tad insulting to be drilled on CompSci 101 questions.
I wish I had this problem! In these rare cases, I just say, "Great job! This was to just double-check you could write code. You'd be surprised how often a candidate isn't able to solve this! Let's talk about your career. In what aspects would you like to grow next?"
It's one thing if we paint it as Leetcode and then ask for fizz-buzz, but when I start the interview off by saying "no algorithms involved, we're not even compiling, it's mostly a way for us to talk about <insert language>" and 15 minutes in you're still looking for a place to shoe horn in a hand rolled hash map, it might just say something about how your approach to engineering.
Many would argue filling FAANG to the brim with people who actively seek complexity is what has directly hurt their ability to innovate (and the fact OpenAI is full of ex-FAANG doesn't disagree)
well I guess now we know why its all so brutal. We are being compared to a state of the art AI. Also we gotta have a compiler installed on our heads. That aside, if you are a hiring manager, ask yourself what your company really needs. Because this format of interview is so outdated, its insane.
We have a proper domain-specific programming test in the later stages of our pipeline, so my phone screen is a smoke test I expect most devs to complete in 10 minutes (we give the full 30 just in case).
We talk through a simple word problem, and at no point do I even require it to compile because I understand that not having your coding development environment choice can throw you off. At most if I spot an obvious syntax error I'll nudge to make sure they spot it and move on.
- Yet the feedback I get is extremely bi-modal: People who write code for a living love it. They had mentally prepped for inverting binary trees while some CS-guru stares them down over Zoom, so having a collaborative problem that takes the same mental process your day to day does is great for them.
But for people who have hyper-optimized for leetcode, it's like their brains shut down. Simple problems they should be able to solve with basic control flow suddenly become these insurmountable wall because they can't pattern match against something they memorized.
Some of this is stuff that the actual engineers will give you a more accurate picture (ex what's the day to day like), but even for those things asking both the engineers and the manager and comparing them can give you an idea of how in touch the manager is with the realities of the team.
Another way to approach this: can the candidate communicate? If they cannot write original code odds are they probably cannot clearly write steps of simple instructions explaining a problem or solution as they do not have experience thinking through the problem without a lot of help.
Most places I interviewed at last year claimed to be looking for senior developers but in practice were only looking for trend chasers doing things in a very limited way that appeals primarily to beginners memorizing patterns.
I structure the hour-long phone screen to be 1/3 coding, 1/3 behavioural questions, and 1/3 career growth and questions for me.
We rarely get out of the coding question block. It's a fairly simple question that ChatGPT solves easily. The tightest solution is about 10 lines of code. It can be answered either with iterative, recursive, or functional code. There is a general case, an empty case, and an exceptional case. It's the type of code I was able to write after completing CMPT 101. I had to change the question since it was so easily solvable by ChatGPT.
Engineers with years of experience at FAANG and similar companies cannot solve this straightforward problem. It's like, what have you been doing with your life? Did everyone do nothing during ZIRPy times and have accumulated years of rust that they now need to shake off?