Tree Basics and some Swift helpers for leetcode
I do leetcoding every once a while, but keep forgetting some tree basics. This post here it to help with that. Node vs Side π‘ This was a very subtle yet βAhaβ moment for me. When youβre traversing down a tree using dfs, while you can do things like: let leftNode = process(node.left) let rightNode = process(node.right) it might be better to see at as: let leftSide = process(node.left) let rightSide = process(node....