PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Meta

Compute longest rising path in a grid

Last updated: Mar 29, 2026

Quick Overview

This question evaluates mastery of graph traversal, dynamic programming, and complexity analysis for computing longest increasing paths in a matrix, focusing on algorithmic correctness and efficient use of time and space.

  • Medium
  • Meta
  • Coding & Algorithms
  • Software Engineer

Compute longest rising path in a grid

Company: Meta

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Given an m×n grid of integers, find the length of the longest path where each step moves up, down, left, or right to a strictly larger value. Return the maximum length over all starting cells. Design an O(mn) solution using memoized DFS or an equivalent iterative/topological approach, and analyze time and space usage. As a follow-up, discuss handling very large grids, recursion-depth limits, and variants such as allowing non-decreasing steps or diagonal moves.

Quick Answer: This question evaluates mastery of graph traversal, dynamic programming, and complexity analysis for computing longest increasing paths in a matrix, focusing on algorithmic correctness and efficient use of time and space.

Related Interview Questions

  • Solve Tree Columns And Maze Variants - Meta (medium)
  • Solve a Key-Door Corridor Maze - Meta (medium)
  • Solve Array Merge and Parentheses Cleanup - Meta (medium)
  • Solve Two Backtracking Array Problems - Meta (hard)
  • Solve Maze and Suffix Problems - Meta (medium)
Meta logo
Meta
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0

Given an m×n grid of integers, find the length of the longest path where each step moves up, down, left, or right to a strictly larger value. Return the maximum length over all starting cells. Design an O(mn) solution using memoized DFS or an equivalent iterative/topological approach, and analyze time and space usage. As a follow-up, discuss handling very large grids, recursion-depth limits, and variants such as allowing non-decreasing steps or diagonal moves.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

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