it is little bit simlar question like longest square streak which you have uploaded sir
@techdose4u2 күн бұрын
yep :) similar but in matrix and instead of 1 call you make 3 calls :)
@praveenabandari5971Күн бұрын
Not all test cases are passing, Time limit exceeded.
@techdose4uКүн бұрын
I checked just now. Its passing. Can you please match line by line to check if you missed pass by reference or something ?
@alessandrocamilleri1239Күн бұрын
Thanks for the great explanation. This is my dp solution using tabulation to save on recursion stack space: int maxMoves(vector& grid) { int m = grid.size(); int n = grid[0].size(); int maxMoves = 0; vector dp (m, vector(n, 0)); for (int i = 0; i < m; i++) dp[i][0] = 1; vector rowDelta {-1, 0, +1}; for (int i = 1; i < n; i++) { for (int j = 0; j < m; j++) { for (int r = 0; r < 3; r++) { int checkRow = j + rowDelta[r]; if (checkRow >= 0 && checkRow < m && grid[checkRow ][i-1] < grid[j][i] && dp[checkRow][i-1] == 1) { dp[j][i] = 1; maxMoves = i; } } } } return maxMoves; }
@techdose4uКүн бұрын
Thanks :)
@sailendrachettri85212 күн бұрын
@techdose4u2 күн бұрын
:)
@kgjr.6224Күн бұрын
sir just a suggestion but insted of solving and explaining the problem in the way where we will get the solution can you make it in the way that we can get the intution of how can we comeUp with those solution my our self like how the neetcode explains the solutions. Also you look very serious and not happy try to enjoy the process of problem solving.
@techdose4uКүн бұрын
I am sleepy not serious 🥹 I just focus on the problem only. I would be chilling in a JOB if I wasnt enjoying this :) so peace!
@alessandrocamilleri1239Күн бұрын
@@kgjr.6224 I think he explained the algo thoroughly through the example. Obviously a good grasp of recursion is a prerequisite and it takes time to wrap your head around it. Techdose's content is very well curated with carefully pre-prepared slides to which he then adds explanations on the fly. He's up there with a few others. As for the "serious" expression, to each his own. Personally, I do not care as long as the content is of quality.
@kgjr.622422 сағат бұрын
@@alessandrocamilleri1239 I am not saying he did not explain the problem or anything like that I am just saying that he started explaining the example right-away. My thought is like he should not explain the ans but how we as common beings existing in this world should get to that solution by our self. The intuition behind the problem. According to me the motive of DSA question is never solving the problem but its why the solution works. why the simple brute force will not work and getting the concept like why we used 2d Array not hashMap like these kind of things. Have you ever watched the videos of Ariyan mittal. try his videos then you might get what I am talking about. I am no hater I am just giving constructive criticism.
@kgjr.622422 сағат бұрын
@@techdose4u And Sir I am not saying you are not happy or not passionate about the thing you are doing. I know no one do these things just for timepass. I am just saying smile little bit in the videos it gives a happy vides because we are here to learn but there is no harm in being happy right.
@techdose4u21 сағат бұрын
I am happy 😃 Happier than ever. But maybe I look different while I am focussing 😅
@ahd-123zКүн бұрын
TLE problem ..
@techdose4uКүн бұрын
dint pass ?
@dhananjayhirey2905Күн бұрын
@@techdose4u no sir...not all TC's are passing
@ahd-123zКүн бұрын
@@techdose4u for very large grid ,the solution is suffering from TLE