PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates proficiency with binary search trees, vertical-order traversal semantics, in-place pointer manipulation for converting a BST into a sorted doubly linked list, and algorithmic complexity analysis within the Coding & Algorithms domain.

  • Medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Implement BST vertical traversal and list conversion

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Given the root of a binary search tree (BST): 1) Implement vertical order traversal: assign the root column 0, left child column −1, right child column +1; return columns from leftmost to rightmost. Within each column, list node values from top to bottom, breaking ties by left-to-right order at the same depth. Provide the algorithm, data structures used, and complexity analysis. 2) Convert the BST into a sorted doubly linked list in-place (non-circular) by reusing nodes (left becomes prev, right becomes next). Return the head of the list. Discuss recursive vs iterative approaches, edge cases (empty tree, single node, skewed tree), and time/space complexity.

Quick Answer: This question evaluates proficiency with binary search trees, vertical-order traversal semantics, in-place pointer manipulation for converting a BST into a sorted doubly linked list, and algorithmic complexity analysis within the Coding & Algorithms domain.

BST Vertical Order Traversal

Given a BST as level-order values, return vertical columns from left to right in breadth-first order within each column.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ([5,3,7,2,4,6,8],)

Expected Output: [[2], [3], [5, 4, 6], [7], [8]]

Explanation: Balanced BST.

Input: ([],)

Expected Output: []

Explanation: Empty tree.

Input: ([5,3,None,2],)

Expected Output: [[2], [3], [5]]

Explanation: Left-skewed partial tree.

Hints

  1. Choose a representation that makes the requested operation direct.
  2. Handle empty inputs and boundary cases first.

BST to Sorted Doubly Linked List Values

Given a BST as level-order values, return the values in the sorted order that the in-place doubly linked list would contain.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ([5,3,7,2,4,6,8],)

Expected Output: [2, 3, 4, 5, 6, 7, 8]

Explanation: Sorted in-order list.

Input: ([1],)

Expected Output: [1]

Explanation: Single node.

Input: ([],)

Expected Output: []

Explanation: Empty tree.

Hints

  1. Choose a representation that makes the requested operation direct.
  2. Handle empty inputs and boundary cases first.
Last updated: Jun 27, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Find Shortest Unique Prefixes - Meta (medium)
  • Compute Exclusive Execution Times - Meta (medium)
  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve Tree Diameter and Palindromic Counts - Meta (medium)
  • Simulate Monster Team Battles - Meta (hard)