Find the mistake when rebuilding a path by following parent pointers.
Codejavascript
function reconstructPath(parent, start, goal) {
const path = [];
let current = goal;
while (current !== start) {
path.push(current);
current = parent[current];
}
// start was never added
return path.reverse();
}