Jump TradingSoftware Engineer · Technical ScreenCodemia practiceFind shortest distance in matrix
Given a 2D matrix of non-negative integers, write a function to find the shortest distance from the top-left corner (0,0) to the bottom-right corner (m-1,n-1) using only right and down moves. The function should return the length of the shortest path, or -1 if there is no valid path. The input will be a matrix of size m x n, and the output should be an integer representing the shortest distance.