Minimum Cost to Make at Least One Valid Path in a Grid | Leetcode 1368