flâneur

Bombed interview, feeling like s : r/leetcode

reddit.com · saved by 1 readers

Spent the past week studying easy / mid problems, got an interview today and completely messed it up. The task was basically to find the `root` in a tree like: I had just before practiced some DFS / BFS problems so I approached this in such a stupidly complex way that afterwards I was shocked to how stupid I was for not figuring it out (the answer is so silly I'm sure in a study environment I could have reached the optimal solution in less than 10 minutes). I managed to get a brute force solution using nested loops but couldn't for the life of me find the simple optimal solution, I kept trying to build a tree from the bottom up, near the end I was close to the optimal solution but ran out of time before having it working. How do y'all avoid getting in this "complexity" mindset? i asked claude for the solution and i feel stupid haha lol I asked qwen code and I feel like a shit... And what did it say? just find the node that isn’t referenced by any node Won’t indegree of root be zero? An

saved by