Minimum Path Sum | minimum path sum | minimum path sum leetcode | leetcode 64 | Part 1

preview_player
Показать описание


For Bottoms-Up DP solution with space optimization 👇

**Complexity Analysis**

Time complexity: O(mn). We traverse the entire matrix once.

Space complexity: O(mn). Another array of row size is used.
Рекомендации по теме
Комментарии
Автор

nice video few code suggestions...
1. always handle null values, grid = null.
2. if you start from the bottom and move up and left then DP array's can be reduced in size. DP[2][n] will be sufficient. since we dont need row n after we have processed row n-1.

mohdwaseem-qnjx
join shbcf.ru