PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Snapchat

Find minimum-latency path across dependent services

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of graph algorithms and shortest-path computation on weighted directed graphs, including handling cycles, multiple edges, and reachability in service dependency models.

  • hard
  • Snapchat
  • Coding & Algorithms
  • Software Engineer

Find minimum-latency path across dependent services

Company: Snapchat

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

You are given a set of services and directed dependencies between them. Each dependency edge represents a call from one service to another with a known latency. - Services are labeled `0..N-1`. - You are given a list of directed edges `(u, v, latency)` meaning service `u` can call service `v` and that hop adds `latency` milliseconds. - Given a `start` service and a `target` service, compute the **minimum total latency** along any valid call chain from `start` to `target`. If there is no route, return `-1`. ### Input - `N`: number of services - `edges`: list of `(u, v, w)` with `w > 0` - `start`, `target` ### Output - Integer minimum total latency (sum of edge weights), or `-1` if unreachable. ### Notes - The dependency graph may contain cycles. - Multiple edges between the same pair may exist; take the best one if helpful.

Quick Answer: This question evaluates understanding of graph algorithms and shortest-path computation on weighted directed graphs, including handling cycles, multiple edges, and reachability in service dependency models.

Related Interview Questions

  • Determine Whether Courses Can Be Completed - Snapchat (medium)
  • Solve Decimal Coin Change - Snapchat (medium)
  • Find Maximum Island Perimeter - Snapchat (medium)
  • Solve Three Algorithmic Tasks - Snapchat (hard)
  • Implement a Timestamped Counter - Snapchat (medium)
Snapchat logo
Snapchat
Feb 11, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0
Loading...

You are given a set of services and directed dependencies between them. Each dependency edge represents a call from one service to another with a known latency.

  • Services are labeled 0..N-1 .
  • You are given a list of directed edges (u, v, latency) meaning service u can call service v and that hop adds latency milliseconds.
  • Given a start service and a target service, compute the minimum total latency along any valid call chain from start to target .

If there is no route, return -1.

Input

  • N : number of services
  • edges : list of (u, v, w) with w > 0
  • start , target

Output

  • Integer minimum total latency (sum of edge weights), or -1 if unreachable.

Notes

  • The dependency graph may contain cycles.
  • Multiple edges between the same pair may exist; take the best one if helpful.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Snapchat•More Software Engineer•Snapchat Software Engineer•Snapchat 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.