PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Uber

Return a Package Build Order

Last updated: May 13, 2026

Quick Overview

This question evaluates a candidate's skills in dependency resolution, graph traversal and cycle detection while reasoning about an externally discovered dependency subgraph and ordering constraints.

  • medium
  • Uber
  • Coding & Algorithms
  • Software Engineer

Return a Package Build Order

Company: Uber

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given an API: ```python get_dependencies(package) -> list[str] ``` It returns the direct dependencies of a given package. If package `A` depends on package `B`, then `B` must be built before `A`. Given a target package name, return any valid build order for the target package and all packages it transitively depends on. Every dependency must appear before the package that depends on it. The dependency graph is not provided upfront; you must discover only the dependency subgraph reachable from the target package by calling `get_dependencies` as needed. Requirements: - Return any valid build order; the order does not need to be unique. - Only include packages that are required to build the target package. - If a circular dependency exists in the reachable dependency graph, return an empty list or raise an error. - Consider edge cases and failure cases, such as missing packages, duplicate dependencies, repeated API calls, and dependency cycles.

Quick Answer: This question evaluates a candidate's skills in dependency resolution, graph traversal and cycle detection while reasoning about an externally discovered dependency subgraph and ordering constraints.

Related Interview Questions

  • Implement Minesweeper and Word Search - Uber (medium)
  • Implement Store Autocomplete - Uber (medium)
  • Implement Cache Eviction And Seat Assignment - Uber (medium)
  • Schedule Non-Overlapping Meetings Efficiently - Uber (hard)
  • Evaluate an Arithmetic Expression - Uber
Uber logo
Uber
Jan 28, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
0
0

You are given an API:

get_dependencies(package) -> list[str]

It returns the direct dependencies of a given package. If package A depends on package B, then B must be built before A.

Given a target package name, return any valid build order for the target package and all packages it transitively depends on. Every dependency must appear before the package that depends on it.

The dependency graph is not provided upfront; you must discover only the dependency subgraph reachable from the target package by calling get_dependencies as needed.

Requirements:

  • Return any valid build order; the order does not need to be unique.
  • Only include packages that are required to build the target package.
  • If a circular dependency exists in the reachable dependency graph, return an empty list or raise an error.
  • Consider edge cases and failure cases, such as missing packages, duplicate dependencies, repeated API calls, and dependency cycles.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Uber•More Software Engineer•Uber Software Engineer•Uber Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,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
  • Compare Platforms
  • Discord Community

Support

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

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.