45 ms·
No, it's not FizzBuzz. It's a recursive algorithm, which FizzBuzz isn't. (Or doesn't have to be. Let's not cite crazy repos with dozens of solutions deliberatel
by jerf 5y ago
No, it's not FizzBuzz. It's a recursive algorithm, which FizzBuzz isn't. (Or doesn't have to be. Let's not cite crazy repos with dozens of solutions deliberately obfuscated.) That automatically takes it out of FizzBuzz range.
If you're a functional programmer, it's probably something you can just bang out. I've done functional programming. But it's been a while. In an interview situation, I'd definitely need some time to struggle through it.
What gives? I claim to be a senior developer of ~25 years experience? Why can't I just bang out the roughly ten-line solution it would be in Haskell, including the requisite data declarations? Well, in my 25 years of experience, yes, I've covered everything that is necessary to do that problem, but I've got to drag it out of storage and rehydrate it manually, because I don't do this sort of thing every day lately. Or ever, really, because what senior dev is running around implementing Computer Science 301 data structures every day anymore? Pretty much just one currently implementing a brand new language that needs those basic structures in its standard library.
I'd get there. It wouldn't even necessarily take long. But I can understand why an interviewer asking this question ten times a week who knows the answer forward and backward might find taking even 5 minutes to be an unimpressive performance for something that such an expert should clearly just be able to scribble down in one shot, right?
And I'm gonna be honest. If you ask me to balance a possibly-unbalanced sorted binary tree, I'm basically going to be re-deriving the answer from scratch. Yeah, I covered it. Probably even did a homework assignment on it in C. But my job for the past 25 years has not been implementing balanced binary trees.