Doordash 店面

Given an integer matrix, find the length of the longest path that have same values. The matrix has no boundary limits.

From each cell, you can either move to two directions: horizontal or vertical. You may NOT move diagonally or move outside of the boundary.

nums = [
[1,1],
[5,5],
[5,5]
]

Return 4 ( Four 5’s).