PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Google

Compute minimax grid path and network delay

Last updated: Mar 29, 2026

Quick Overview

This question evaluates algorithmic problem-solving in shortest-path and path-optimization contexts, specifically minimax pathfinding on a grid and single-source reachability/timing in a weighted directed graph, testing graph modeling, alternative path cost metrics, edge-case handling, and working with large numeric weights.

  • hard
  • Google
  • Coding & Algorithms
  • Software Engineer

Compute minimax grid path and network delay

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

## Problem (two related shortest-path tasks) ### Part 1 — Minimize the maximum value along a grid path ("minimax" path) You are given an `m x n` integer grid `H`, where `H[r][c]` is the “difficulty/height” of cell `(r,c)`. - Start at `(0,0)` and want to reach `(m-1, n-1)`. - You may move **up/down/left/right** to adjacent cells (no diagonals). - The **cost of a path** is **not the sum** of values; instead it is: > the maximum `H[r][c]` value encountered on that path (including start and end). **Return** the minimum possible path cost (i.e., minimize the maximum cell value you ever step on). **Assumptions/constraints (typical interview constraints):** - `1 <= m,n <= 200` - `0 <= H[r][c] <= 10^9` ### Part 2 (follow-up) — Time for a signal to reach all nodes in a weighted graph You are given a weighted graph with `n` nodes labeled `1..n` and a list of directed edges `edges`, where each edge is `(u, v, w)` meaning it takes time `w > 0` to travel from `u` to `v`. A signal starts at node `k` at time `0` and travels along edges. - Let `dist[i]` be the shortest time for the signal to reach node `i`. - **Return**: - `max(dist[i])` over all nodes `i` if every node is reachable, or - `-1` if some node is unreachable. **Assumptions/constraints (typical interview constraints):** - `1 <= n <= 10^5` (or smaller in an interview) - `1 <= |edges| <= 2*10^5` - `1 <= w <= 10^9` ## Edge cases to consider - Start equals end (Part 1: `m=n=1`; Part 2: `n=1`). - Unreachable nodes (Part 2). - Multiple edges between the same nodes (Part 2). - Repeated states pushed into a heap/priority queue (both parts).

Quick Answer: This question evaluates algorithmic problem-solving in shortest-path and path-optimization contexts, specifically minimax pathfinding on a grid and single-source reachability/timing in a weighted directed graph, testing graph modeling, alternative path cost metrics, edge-case handling, and working with large numeric weights.

Related Interview Questions

  • Solve Flower Placement and Directory Deletion - Google (medium)
  • Compute Turnstile Crossing Times - Google (hard)
  • Simulate In-Place Cellular State Updates - Google (hard)
  • Determine Whether a Word Exists in a Graph - Google (medium)
  • Implement Checksums and Feature Rollout Evaluation - Google (medium)
Google logo
Google
Jan 22, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
17
0
Loading...

Problem (two related shortest-path tasks)

Part 1 — Minimize the maximum value along a grid path ("minimax" path)

You are given an m x n integer grid H, where H[r][c] is the “difficulty/height” of cell (r,c).

  • Start at (0,0) and want to reach (m-1, n-1) .
  • You may move up/down/left/right to adjacent cells (no diagonals).
  • The cost of a path is not the sum of values; instead it is:

the maximum H[r][c] value encountered on that path (including start and end).

Return the minimum possible path cost (i.e., minimize the maximum cell value you ever step on).

Assumptions/constraints (typical interview constraints):

  • 1 <= m,n <= 200
  • 0 <= H[r][c] <= 10^9

Part 2 (follow-up) — Time for a signal to reach all nodes in a weighted graph

You are given a weighted graph with n nodes labeled 1..n and a list of directed edges edges, where each edge is (u, v, w) meaning it takes time w > 0 to travel from u to v.

A signal starts at node k at time 0 and travels along edges.

  • Let dist[i] be the shortest time for the signal to reach node i .
  • Return :
    • max(dist[i]) over all nodes i if every node is reachable, or
    • -1 if some node is unreachable.

Assumptions/constraints (typical interview constraints):

  • 1 <= n <= 10^5 (or smaller in an interview)
  • 1 <= |edges| <= 2*10^5
  • 1 <= w <= 10^9

Edge cases to consider

  • Start equals end (Part 1: m=n=1 ; Part 2: n=1 ).
  • Unreachable nodes (Part 2).
  • Multiple edges between the same nodes (Part 2).
  • Repeated states pushed into a heap/priority queue (both parts).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

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