4 ms·
Easier? You usually aren't coding FizzBuzz in production code either (although probably more often than inverting binary trees.)
by pessimizer 4y ago
Easier? You usually aren't coding FizzBuzz in production code either (although probably more often than inverting binary trees.)
- snozolli 4y agoEasier? What's easier? You usually aren't coding FizzBuzz in production code either I would say you're constantly coding FizzBuzz. Looping, modulus arithmetic, and conditionals are all over the code I've written. At least with FizzBuzz you have a test of a person's ability to understand a task, break it down, and make sure the logic is consistent. With tree "inversion" it's not even a sensical request, it's utterly useless, and there are countless more interesting and practical ways to test understanding of recursion and trees. Knowledge that, I would bet, isn't even relevant for 90% of programmers, and if tree traversal were relevant then you'd probably want to jump to way more difficult questions (I'm thinking of the Facebook graph, for example). I agree with the other commenter that it would make far more sense to ask questions like "you need to process data of this type, what provided data structure (e.g. C++'s STL) would you choose?"
- zeroonetwothree 4y agoI've certainly done tree traversal far more than modular arithmetic (at least at work, for fun I do recreational math problems...)