PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates a candidate's competence in graph traversal and path-optimization concepts, emphasizing reasoning about path scores and handling grid-based constraints.

  • medium
  • Crowdstrike
  • Coding & Algorithms
  • Software Engineer

Maximize the minimum value along a grid path

Company: Crowdstrike

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

You are given an `m x n` integer matrix `A`. You start at the top-left cell `(0,0)` and want to reach the bottom-right cell `(m-1,n-1)` by moving only in 4 directions (up/down/left/right). For any path, define its **score** as the minimum value among all cells on that path. **Task**: Return the maximum possible path score. ### Input - `A`: `m x n` matrix of integers ### Output - An integer: the maximum achievable path score ### Constraints - `1 <= m, n <= 300` - `-10^9 <= A[i][j] <= 10^9` ### Example Input: ``` 5 4 5 1 2 6 7 4 6 ``` Output: ``` 4 ``` Explanation: One optimal path has minimum cell value 4, and no path can achieve a minimum > 4.

Quick Answer: This question evaluates a candidate's competence in graph traversal and path-optimization concepts, emphasizing reasoning about path scores and handling grid-based constraints.

You are given an m x n integer matrix A. You start at the top-left cell (0, 0) and want to reach the bottom-right cell (m - 1, n - 1) by moving one step at a time in four directions: up, down, left, or right. The score of a path is the minimum value among all cells visited on that path, including the start and end cells. Return the maximum possible score among all valid paths from the start to the destination.

Constraints

  • 1 <= m, n <= 300
  • -10^9 <= A[i][j] <= 10^9
  • A is a rectangular matrix

Examples

Input: [[5,4,5],[1,2,6],[7,4,6]]

Expected Output: 4

Explanation: One optimal path is 5 -> 4 -> 5 -> 6 -> 6, whose minimum value is 4. No path can achieve a higher minimum.

Input: [[-5,-1],[-4,-7]]

Expected Output: -7

Explanation: Every valid path must end at -7, so the score cannot be greater than -7. Both possible paths have minimum value -7.

Input: [[8]]

Expected Output: 8

Explanation: The start and destination are the same cell, so the path score is simply 8.

Input: [[2,2,1,2,2,2],[1,2,2,2,1,2]]

Expected Output: 2

Explanation: There is a path from start to finish using only cells with value 2, so the minimum along that path is 2. Since the starting cell is 2, the answer cannot be larger than 2.

Input: [[7,5,3],[2,0,9],[4,5,9]]

Expected Output: 3

Explanation: The best route is 7 -> 5 -> 3 -> 9 -> 9, whose minimum is 3. Any other route is forced through a smaller bottleneck such as 2 or 0.

Hints

  1. If you guess a score X, can you check whether there is a path from start to end using only cells with value at least X?
  2. A priority queue can help you always extend the currently best bottleneck path first.
Last updated: Jun 1, 2026

Related Coding Questions

  • Count connected components in a binary grid - Crowdstrike (medium)
  • Implement templated string replacement - Crowdstrike (medium)

Loading coding console...

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.