3 ms·
Ya, but the important question is can they invert a binary tree on a whiteboard?
by jjeaff 6y ago
Ya, but the important question is can they invert a binary tree on a whiteboard?
- mangamadaiyan 6y ago... or are leetcode-proficient, these days.
- umvi 6y agoJust get a clear whiteboard, draw the binary tree, then flip the whiteboard 180 around the vertical axis so you are now looking through the back of the whiteboard.
- repsilat 6y agoHonestly, it's an O(1) solution depending on choice of data structure, possibly constant-factor more efficient through your program depending on language, and if you're programming on a whiteboard it might also arguably be the idiomatic way to do it in that context. Limited in that you can only have one tree per whiteboard, though.
- qppo 6y ago"Write an FFT" is the DSP engineer interview question that's analogous to tree traversal algorithm whiteboarding. The hard part is remembering how a butterfly computation works, and you'll almost never need to implement it.