PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

Practice a Databricks coding interview problem focused on find a path between nodes in a fibonacci tree. The prompt emphasizes edge cases, clean implementation, and verifiable test behavior without revealing the solution.

  • hard
  • Databricks
  • Coding & Algorithms
  • Software Engineer

Find a Path Between Nodes in a Fibonacci Tree

Company: Databricks

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Take-home Project

A Fibonacci tree `T(n)` has single-node trees `T(0)` and `T(1)`. For `n >= 2`, the root has left subtree `T(n-2)` and right subtree `T(n-1)`. Nodes are labeled in preorder from `1`. Given labels `a` and `b`, return a shortest path from `a` to `b` using `U`, `L`, and `R`. Implement: ```python def fibonacci_tree_path(n: int, a: int, b: int) -> str: pass ``` Do not build the tree for large `n`; use subtree sizes.

Quick Answer: Practice a Databricks coding interview problem focused on find a path between nodes in a fibonacci tree. The prompt emphasizes edge cases, clean implementation, and verifiable test behavior without revealing the solution.

Return a shortest U/L/R path between two preorder labels in a recursively defined Fibonacci tree.

Examples

Input: {"n":2,"a":1,"b":2}

Expected Output: "L"

Explanation: Root to left child.

Input: {"n":2,"a":2,"b":3}

Expected Output: "UR"

Explanation: Left child to right child.

Input: {"n":3,"a":2,"b":4}

Expected Output: "URL"

Explanation: Across root subtree.

Input: {"n":3,"a":4,"b":5}

Expected Output: "UR"

Explanation: Parent to right child.

Input: {"n":4,"a":1,"b":7}

Expected Output: "RR"

Explanation: Root to nested right-right.

Input: {"n":4,"a":7,"b":1}

Expected Output: "UU"

Explanation: Nested node to root.

Input: {"n":5,"a":3,"b":3}

Expected Output: ""

Explanation: Same node.

Input: {"n":5,"a":4,"b":10}

Expected Output: "UURLR"

Explanation: Different branches.

Last updated: Jul 4, 2026

Loading coding console...

PracHub

Master your tech interviews with 8,500+ 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

  • Design an n x n Tic-Tac-Toe Game - Databricks (medium)
  • IPv4 CIDR Range Membership Queries - Databricks (medium)
  • Optimal Commute: Nearest Transit Distance in a City Grid - Databricks (medium)
  • Choose the Best Travel Mode - Databricks (medium)
  • Implement an Alternating Tic-Tac-Toe Game - Databricks (hard)