3 ms·
The problem wasn't to just reverse the nodes, it was to re-sort it: > @rogerdai16 to min-max the tree, ascending to descending. https://twitter.com/mxcl/statu
by de_Selby 11y ago
The problem wasn't to just reverse the nodes, it was to re-sort it:
> @rogerdai16 to min-max the tree, ascending to descending.
https://twitter.com/mxcl/status/608891015945170944 https://twitter.com/mxcl/status/608891015945170944
- SamReidHughes 11y agoI can't stand this. That's an equally intelligible description of the problem as the original.
- de_Selby 11y agoWell it's a 140 character description from someone who's probably feeling a bit emotional. I'm sure he got a clearer problem description in the actual interview.
- rubydevsfail 11y agoRuby solution: Gem install ruby_dev_failz_compsci_101
- falcolas 11y agoI have to admit, the idea of swapping children on all of the nodes would not have come to me immediately as a solution for reversing the sorted tree - I have not been exposed to that kind of application before, and haven't spent a lot of time thinking about that kind of problem. One more for the toolbox, I guess.
- blahblah3 11y agoIt sounds like the problem may have been to convert a min heap to a max heap?