GamifiedGamified challengesPracticeRaceLeaderboardPricing

Learn data structures by watching them move, then doing it yourself. Press M anytime to toggle sound.

A product of Amypo Technologies, Coimbatore.

Learn

  • All topics
  • Learning path
  • How it works
  • About dotprep

Practice

  • Practice arena
  • Daily challenge
  • Gamified challenges
  • Race mode
  • Leaderboard

Interview prep

  • Java interview
  • Coding questions
  • Company questions
  • System design
  • Jobs & careers

You

  • Dashboard
  • Settings
  • Pricing
  • Create account

© 2026 dotprep

Content last updated 20 November 2026

GamifiedGamified challengesPracticeRaceLeaderboardPricing
Log inStart free
Gamified challengesSignal Broadcast

Gamified challenge · Dijkstra

Signal Broadcast

There are n towers numbered 0 to n - 1. Each entry [u, v, t] of times is a one-way cable: a signal at tower u reaches tower v after t time units (t ≥ 1). Tower src broadcasts at time 0, and every tower relays the signal down all its cables the moment it first hears it.

Write delay(times, n, src) that returns the time at which the last tower hears the signal, or -1 if some tower never hears it.

Example: with times = [[0,1,4],[0,2,1],[2,1,2],[1,3,1],[2,3,5],[3,4,3]], n = 5, src = 0, towers hear it at 0, 3, 1, 4, 7, so the answer is 7.

Sign in to play Signal Broadcast

This game is part of the paid plans. Sign in, then pick a plan to write your answer, watch it play out, and step through the algorithm with its guide.

Sign in with Google

or log in with email · create an account