Fork me on GitHub
#adventofcode
<
2021-06-29
>
Noel Llevares06:06:59

Thank you @tws, @yubrshen, @nbardiuk. I spent a considerable time thinking of an O(1) answer and when I failed to come up with one, I just settled for a brute-force. I still have a long way to go. I can build full-stack apps, microservices, CI/CD pipelines and data pipelines but algorithms is a hard one. I have no computer science/engineering background so I’m working hard to catch up on these. To be honest, 90% of what you guys said above sound alien to me but I will do my best to be better.

spfeiffer08:06:17

I do not know if this helps you in your case, but i feel algorithm related interview questions are absolutely useless for assessing engineering performance on real life problems. Besides some edge cases, you will not need to implement low level algorithms. What these exercises perhaps show is how you work towards any solution, may it as bad as it can be, not about to show you can deliver a „good“ solution to an artificial problem under pressure.

pez06:06:34

Thanks for posting this question, @noelmartin! I learn a lot reading the answers. Of course thank you all answering as well. 😃

5
nbardiuk07:06:06

To be honest in real life interview under stress I would go with brute force solution as you did. The solution with trees is too complex for me to do without rereading docs. And the O(1) solution I've found only after implementing brute force and searching internet for this sequence of numbers. Thanks for puzzle, it was fun 🙂

slipset07:06:28

Not that many devs actually have to solve the kind of problems you get in interviews. But some regard those problems as a good proxy for how you’ll perform in a job. Others do not.

😂 5
👍 3
2
tws10:06:55

FWIW, this is very similar to problem 8.14 from Cracking the Coding Interview. Even mentions Catalan numbers as something nobody would be expected to know. Goes through a few different approaches.

tws10:06:10

its all just part of the Interview-Industrial Complex. :face_vomiting:

😂 12