Find the Longest Strictly Increasing Cardinal Matrix Path

Quick Overview

Find the Longest Strictly Increasing Cardinal Matrix Path. Return the greatest number of cells in a strictly increasing matrix path. Moves are only up, down, left and right inside the matrix; no diagonal movement or wra

Find the Longest Strictly Increasing Cardinal Matrix Path

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Other

### Problem Return the greatest number of cells in a strictly increasing matrix path. Moves are only up, down, left and right inside the matrix; no diagonal movement or wraparound is allowed. ```cpp int longestIncreasingPath(vector<vector<int>>& matrix); ``` ### Examples ```text matrix = [[1,2],[4,3]] -> 4 matrix = [[7,7]] -> 1 ``` ### Constraints - Both dimensions are 1 through 200. - Values lie in [0,2147483647].

Overview: Find the Longest Strictly Increasing Cardinal Matrix Path. Return the greatest number of cells in a strictly increasing matrix path. Moves are only up, down, left and right inside the matrix; no diagonal movement or wra

Google logo
Google
Source window: 0–3 months · as of Oct 21, 2026
hardSoftware EngineerOtherCoding & Algorithms
0
0

Problem

Return the greatest number of cells in a strictly increasing matrix path. Moves are only up, down, left and right inside the matrix; no diagonal movement or wraparound is allowed.

int longestIncreasingPath(vector<vector<int>>& matrix);

Examples

matrix = [[1,2],[4,3]] -> 4
matrix = [[7,7]] -> 1

Constraints

  • Both dimensions are 1 through 200.
  • Values lie in [0,2147483647].