NeetCode #467LC-2096MediumTrees
← Back to All Problems

#467 · #2096 · Step-By-Step Directions From a Binary Tree Node to Another(从二叉树一个节点到另一个节点每一步的方向)

📌 Problem Statement & Constraints

Given the root of a binary tree with unique values from 1 to n, and two values startValue and endValue, return the shortest path from the start node to the end node as a string of 'L', 'R' and 'U'. Constraints: the number of nodes is in [2, 10^5], all values are distinct.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!