<aside> 💡 Do a DFS inorder. Get Kth element from the visited array.
</aside>
https://leetcode.com/problems/kth-smallest-element-in-a-bst/
function dfs(node) {
if (!node) return;
visited.push(node.val);
dfs(node.left);
dfs(node.right);
}
<aside> 💡 Run a DFS. Swap left and right.
</aside>
https://leetcode.com/problems/invert-binary-tree/
function dfs(node) {
if (!node) {
return null;
}
[node.left, node.right] = [node.right, node.left];
dfs(node.left);
dfs(node.right);
}