← Microsoft questions
CodingReported in a candidate post, Oct 2020

Longest Consecutive Sequence in Binary Tree

Filed under Microsoft · Also reported at Amazon

Given the root of a binary tree, find the length of the longest path where each node is consecutive to its parent (i.e., node value is parent value + 1). Implement the node and tree classes from…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Microsoft questions

Collected from public candidate posts and coding forums. Updated Nov 2026.