PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/TikTok

Compute pipeline order from dependencies

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of graph algorithms and dependency resolution, specifically topological sorting and cycle detection, along with competence in choosing appropriate data structures and analyzing time/space complexity.

  • Medium
  • TikTok
  • Coding & Algorithms
  • Software Engineer

Compute pipeline order from dependencies

Company: TikTok

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

You are given a set of pipelines and a list of directed dependency pairs (A, B) meaning pipeline A depends on pipeline B and therefore B must run before A. Return one valid execution order that satisfies all dependencies, or report that no such order exists if there is a cycle. For example, for pipelines [P1, P2, P3] with dependencies [(P1, P 2), (P3, P 2)], produce a valid order such as [P2, P1, P3]. Describe the algorithm, data structures used, and time/space complexity. Provide code using both a DFS-based topological sort and Kahn’s algorithm, and discuss how you would handle tie-breaking among independent pipelines and very large graphs.

Quick Answer: This question evaluates understanding of graph algorithms and dependency resolution, specifically topological sorting and cycle detection, along with competence in choosing appropriate data structures and analyzing time/space complexity.

Related Interview Questions

  • Parse a nested list from a string - TikTok (medium)
  • Implement stacks, streaming median, and upward path sum - TikTok (easy)
  • Maximize sum with no adjacent elements - TikTok (medium)
  • Implement stack variants and path-sum check - TikTok (medium)
  • Find the longest palindromic substring - TikTok (easy)
TikTok logo
TikTok
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
4
0

You are given a set of pipelines and a list of directed dependency pairs (A, B) meaning pipeline A depends on pipeline B and therefore B must run before A. Return one valid execution order that satisfies all dependencies, or report that no such order exists if there is a cycle. For example, for pipelines [P1, P2, P3] with dependencies [(P1, P 2), (P3, P 2)], produce a valid order such as [P2, P1, P3]. Describe the algorithm, data structures used, and time/space complexity. Provide code using both a DFS-based topological sort and Kahn’s algorithm, and discuss how you would handle tie-breaking among independent pipelines and very large graphs.

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More TikTok•More Software Engineer•TikTok Software Engineer•TikTok Coding & Algorithms•Software Engineer Coding & Algorithms
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
  • Compare Platforms
  • Discord Community

Support

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

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.