</>OfferRetriever
DashboardDiscuss
NEW

Summer Sale

Limited Time Deal: Unlock all premium questions for over 30% off

$10.42$7.08

14

:

03

:

47

:

26

Get this deal
Back to Dashboard

N-ary Tree Node Distance

Medium
FREE

You are given an N-ary tree. Each node has a unique integer value val and a list of child nodes. Given two integer values a and b representing nodes in the tree, return the minimum number of edges needed to travel from node a to node b. If either node is not present in the tree, return -1.


...

OfferRetriever

Master technical interviews with real questions from top companies. Build your confidence and career.

PRODUCT
PricingDashboardDiscussOfferRetriever vs LeetCode
LEGAL
POPULAR COMPANIES
GoogleMetaAmazonMicrosoftNetflixStripeUberTikTokBrowse all companies →

© 2026 Purple Business Holdings LLC. All rights reserved. See Terms of Service.