Solve a classic algorithmic challenge (e.g., dynamic programming or graph traversal) under time-pressure constraints.
Implement longest_increasing_path(matrix) to return the length of the longest strictly increasing path in an integer matrix. From each cell, you may move up, down, left, or right, and each next value must be larger than the current value. The input is a non-empty rectangular list of lists, and the output is an integer path length.
def longest_increasing_path(matrix):