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.
Once I got through building the tree from the messed up format it was given in, it was actually a pretty straight forward BFS problem. Also, I would like to add that practicing building a graph representation of data given in a messed up format is excellent practice as this is highly likely to occur during an interview. Haven't seen too many python solutions, so here's mine:
Swap Nodes [Algo]
You are viewing a single comment's thread. Return to all comments →
Once I got through building the tree from the messed up format it was given in, it was actually a pretty straight forward BFS problem. Also, I would like to add that practicing building a graph representation of data given in a messed up format is excellent practice as this is highly likely to occur during an interview. Haven't seen too many python solutions, so here's mine: