unique paths | unique paths leetcode | leetcode 62

preview_player
Показать описание
(00:00) Explanation & Recusrsive Implementation
(06:16) Top Down DP
(09:17) Bottom Up DP
(11:19) Space Optimized Bottom Up DP

Subscribe for more educational videos on data structure, algorithms and coding interviews.

#Recursive #TopDownDP #BottomUpDP #Coding #UniquePaths #Programming #Interview #Practice #Leetcode #62 #Algorithm #Java #Preparation
Рекомендации по теме
Комментарии
Автор

I tried a simple recursive DFS and got TLE, when the m = 23 and n = 12.

travelwithsatheesh
Автор

class Solution {
public int uniquePaths(int m, int n) {
if(m==1 || n==1){
return 1 ;
}

if(m<1 || n<1){
return 0 ;
}

int h=uniquePaths(m-1, n) ;
int v=uniquePaths(m, n-1 ) ;

int total = h+v ;

return total ;
}
}

abhishekranjan
welcome to shbcf.ru