1
var getDirections = function (root, startValue, destValue) {2
const getPath = (node, value, acc = "") => {5
} else if (node.val === value) {9
getPath(node.left, value, acc + "L") +10
getPath(node.right, value, acc + "R")16
let startPath = getPath(root, startValue);17
let destPath = getPath(root, destValue);19
// find the lowest common ancestor23
i < startPath.length && i < destPath.length && startPath[i] === destPath[i];27
// output the final path29
for (let j = i; j < startPath.length; j++) {33
return output + destPath.substring(i);