Company: Epam Ai native software engineer Oncampus_15july

Difficulty: medium

Problem Statement

Given an m x n integer matrix, return the length of the longest strictly increasing (ascending) path in the matrix. You can start at any cell in the matrix and move in four possible directions: left, right, up, or down . You may not move diagonally, nor can you move outside the boundary (wrap-around is not allowed). The path must strictly increase, meaning each step must be to a cell with a larger value than the previous one. Input Format The first line contains an integer m , the number of rows in the matrix. The second line contains an integer n , the number of columns in the matrix. The next m lines each contain n integers, representing the matrix elements. Output Format Print a single integer representing the length of the longest increasing path in the matrix. Constraints 1 ≤ m, n ≤ 200 0 ≤ matrix[i][j] ≤ 2 31 - 1 Sample Input 1 3 3 9 9 4 6 6 8 2 1 1 Sample Output 1 4 Explanation 1 The longest ascending path starts at the cell with value 1 and ascends through 2, 6, and

More Epam Ai native software engineer Oncampus_15july OA questionsInterview experiences