dfs that takes a node and a boolean indicating if it's lonely.null, return immediately.true), add its value to the result list.dfs on the left child with true if the right child is null, otherwise false.dfs on the right child with true if the left child is null, otherwise false.dfs on the root with false since the root is never lonely.