We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I'm a JS guy, so handling the trees in Python has been a learning experience. I had no idea that print had additional params, so my solution ended up being rather convoluted, building a list of dictionaries that track node.info and vertical and horizontal offsets, eventually gets sorted, and then gets mapped to an array of strings that is joined and printed. It was nasty. Haha
Thanks!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Tree : Top View
You are viewing a single comment's thread. Return to all comments →
I'm a JS guy, so handling the trees in Python has been a learning experience. I had no idea that print had additional params, so my solution ended up being rather convoluted, building a list of dictionaries that track
node.info
and vertical and horizontal offsets, eventually gets sorted, and then gets mapped to an array of strings that is joined and printed. It was nasty. HahaThanks!