Path with Maximum Gold | Simplest Explanation | Leetcode 1219 | codestorywithMIK

Whatsapp Community Link : www.whatsapp.com/channel/0029...
This is the 12th Video of our Playlist "Backtracking : Popular Interview Problems" by codestorywithMIK
In this video we will try to solve a very standard and simple 2D DFS/BFS traversal problem with a tadka of backtracking array : Path with Maximum Gold | Simplest Explanation | Leetcode 1219 | codestorywithMIK
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.
Problem Name : Path with Maximum Gold | Simplest Explanation | Leetcode 1219 | codestorywithMIK
Company Tags : GOOGLE
My solutions on Github(C++ & JAVA) : github.com/MAZHARMIK/Intervie...
Leetcode Link : leetcode.com/problems/path-wi...
My DP Concepts Playlist : • Roadmap for DP | How t...
My Graph Concepts Playlist : • Graph Concepts & Qns -...
My Recursion Concepts Playlist : • Introduction | Recursi...
My GitHub Repo for interview preparation : github.com/MAZHARMIK/Intervie...
Instagram : / codestorywithmik
Facebook : / 100090524295846
Twitter : / cswithmik
Subscribe to my channel : / @codestorywithmik
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Summary :
The provided approach utilizes depth-first search (DFS) to explore all possible paths starting from each cell containing gold in a given grid. It iterates through each cell in the grid and initiates DFS from cells with non-zero gold values. During DFS, it recursively explores neighboring cells, marking visited cells and accumulating the gold values along the path. Once all possible paths are explored from a cell, it backtracks to explore other paths. The maximum accumulated gold value from all possible paths is returned as the result.
✨ Timelines✨
00:00 - Introduction
00:32 - Problem Explanation
6:10 - Explaining DFS Approach
10:54 - Coding it up
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #newyear2024

Пікірлер: 97

  • @indrajitpal02
    @indrajitpal0220 күн бұрын

    I have been following you for the last 2-3 weeks and frankly speaking your videos are adding a very much significant value in my learning path. Talking about today's question I don't have to see any tutorial as I can solve today's question alone. Then came again to your video to see which approach you are talking about. Your effort / videos are appreciated.

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    So glad to hear that. Thank you so much ❤️🙏

  • @literally_ankur
    @literally_ankur20 күн бұрын

    This channel is a goldmine for learning dsa 🤩

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    Means a lot ❤️❤️🙏🙏

  • @aws_handles

    @aws_handles

    20 күн бұрын

    indeed

  • @davidmiller814
    @davidmiller81420 күн бұрын

    You explain with the patience of an angel.

  • @aws_handles
    @aws_handles20 күн бұрын

    Believe nahi hota ki mai ab aise qns khud se solve karleta hu. I have seen growth in me and the power of consistency. Even if I am busy with my dev related study routine, I give atleast 1-2 hours to DSA. Thanks to you for improving my problem solving skills

  • @EB-ot8uu
    @EB-ot8uu20 күн бұрын

    love your voice and calmness. I was able to solve this on my own. thanks to you

  • @Strawcontamination
    @Strawcontamination21 күн бұрын

    Was able to do it after seeing your backtracking playlist

  • @pradyumnmulegaon385
    @pradyumnmulegaon38520 күн бұрын

    bro can u plz provide bfs solution too..or make a video on it ... btw the explanation was really nice bro..

  • @rohitaggarwal8776
    @rohitaggarwal877620 күн бұрын

    Great content. Thanks

  • @spdh6325
    @spdh632520 күн бұрын

    I solved it because of you. I learned this type of solution from you the island problems.... Thank You Mik. you are so helpful for me and Others. Keep uploading

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    So glad to hear that. Thank you so much ❤️🙏

  • @reyazahmed4855
    @reyazahmed485520 күн бұрын

    Great video as usual

  • @Inspire_with_SM
    @Inspire_with_SM20 күн бұрын

    Bhaiya mey bhi DFS se hi approach kiya like question read karte samay hi pata chal gya tha jab wal 4-directions ki baat bola to , 98% faster in java --> my code class Solution { // Approach --> DFS // T.C : O(n*m)*4(k) where k is the count of the gold passibilities // S.C : O(1) Stack space --> depth of recursion -> 4(k) int[] roww = {1, -1, 0, 0}; int[] coll = {0, 0, -1, 1}; public int checkIfAllZeros(int[][] grid) { int count = 0; for (int i = 0; i for (int j = 0; j if (grid[i][j] != 0) count += grid[i][j]; else return 0; } } return count; } public int backtrack(int[][] grid, int x, int y, int count) { if (x = grid.length || y = grid[0].length || grid[x][y] == 0) return 0; int curr = grid[x][y]; grid[x][y] = 0; count += curr; int localMaxGold = 0; for (int i = 0; i int newX = x + roww[i]; int newY = y + coll[i]; localMaxGold = Math.max(localMaxGold,backtrack(grid, newX, newY, count)); } grid[x][y] = curr; return curr + localMaxGold; } public int getMaximumGold(int[][] grid) { int count = checkIfAllZeros(grid); if (count != 0) return count; int maxGold = 0; for (int i = 0; i for (int j = 0; j if (grid[i][j] != 0) { maxGold = Math.max(maxGold, backtrack(grid, i, j, 0)); } } } return maxGold; } }

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    Awesome 👍🏻❤️

  • @SarthakKumar
    @SarthakKumar20 күн бұрын

    i have one question bhaiya vector directions{{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; when i used this, i got TLE why ? and this one works fine. vector directions{{-1, 0}, {1, 0}, {0, 1}, {0, -1}};

  • @tslnr
    @tslnr21 күн бұрын

    This is very similar to unique paths 3, was able to solve this question on my own after seeing that. Thanks man 💙

  • @codestorywithMIK

    @codestorywithMIK

    21 күн бұрын

    Indeed ❤️

  • @Mohit-fe5hx

    @Mohit-fe5hx

    21 күн бұрын

    @@codestorywithMIK vector direction{{-1,0},{1,0},{0,1},{0,-1}}; isko DFS fxn k andar lene se TLE q de rha h...please explain

  • @sachinaswal29

    @sachinaswal29

    20 күн бұрын

    @@Mohit-fe5hx use &direction

  • @Strawcontamination
    @Strawcontamination21 күн бұрын

    Please make a video on matchstick to square

  • @dm_xe
    @dm_xe20 күн бұрын

    please also give the optimal approach in the same video. Thank you

  • @ankanbrahmachary6581
    @ankanbrahmachary658120 күн бұрын

    At any moment during the DFS traversal, only one path is explored, so only a constant number of function calls are in the call stack. the depth of the recursion tree can reach up to the total number of cells in the grid in the worst case scenario. Therefore, the maximum stack space used is the maximum depth of the recursion tree, which is O(m * n). please correct me if i am wrong .. i was able to solve this on my own thanks to your awesome teachings .. i have learnt a lot from you.. thanks for making DSA easy and fun

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    That’s a good point. Yes the recursion stack can grow to m*n in worst case.

  • @ankanbrahmachary6581

    @ankanbrahmachary6581

    20 күн бұрын

    @@codestorywithMIK thank you for confirming

  • @adrijachoudhury4034
    @adrijachoudhury403420 күн бұрын

    bhaiya can you explain that new[i] and new[j] wala lines in detail?

  • @gauravbanerjee2898
    @gauravbanerjee289820 күн бұрын

    Thanks a lot bhaiya congrats for 47k subs 🥳🥳❤❤

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    Thank you so much 😀

  • @yashkalia2311
    @yashkalia231120 күн бұрын

    The greatest ever on youtube!

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    Means a lot to me 🙏🙏❤️❤️

  • @rushikesh_nale07
    @rushikesh_nale0720 күн бұрын

    I was literally laughing "Backtracking jaay bhaad me" 😂😂

  • @nish0798
    @nish079821 күн бұрын

    bro please make concept playlist on backtracking bhai backtracking ke questions mein pata hi nail chailata kaise karna hai specillay kai questions mein where we use visited mark it false and and once task done make it true agin ye sab kaise paa chata hai ki questin me vis ko false mark karke true mark karna hai please make playlist and try to explain ki konse scenario mein konsa approach lagega

  • @codestorywithMIK

    @codestorywithMIK

    21 күн бұрын

    Hi there, Sure. But before studying backtracking, You must study Recursion Concepts - How recursion flow goes and rewinds, how recursion tree progresses etc. You can see my Recursion concepts - kzread.info/dash/bejne/opqWk7ydpcjZmZs.html Meanwhile, let me soon plan to make one long video which will cover all concepts of backtracking. Remember that in Backtracking , recursion is heavily used, so make sure to first go through recursion concepts

  • @nish0798

    @nish0798

    20 күн бұрын

    @@codestorywithMIK tHANKS BRO ya please make 1 long vidoe of backtacking where u cover all the concepts ,patterns and some questions regarding that concept I mean first the concept and pattern and then the releveant this way it would be clear and would allow us to think

  • @nish0798

    @nish0798

    20 күн бұрын

    then the relevant question to that concept this way it would be clear and would allow us to think

  • @alokgautam02
    @alokgautam0215 күн бұрын

    why can't we use here bfs/dfs , please explain in detail?

  • @its__aakashg_
    @its__aakashg_21 күн бұрын

    Khud se ban bhaiya .. thanks for such quality contnet

  • @ShyamSundar-kz5oz
    @ShyamSundar-kz5oz21 күн бұрын

    Sir please phala dp series complete kara do 🙏🏻🙏🏻

  • @idiomz4104
    @idiomz410420 күн бұрын

    I'm trying to understand why we didn't use memoization here? I can sense that there is overlapping problems we keep solving. Think about it from symmetry, if we go a to z in a certain path, z to a can be in that same path but in reverse as well.

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    No, here we can’t use DP. I should have covered this point in my video. Let me try to explain here. For a given cell [i][j] , we can have different values depending on the cell from where you started your DFS. so you can’t store any past result in a dp array i.e. you can’t memoize or use previous results to solve your current result. Hence you can’t use DP in such cases. Everytime you are trying your dfs from different cell from the main double for loop and for each starting cell, every cell [i][j] can have different value. So memoizing value of [i][j] doesn’t make sense here Hope this helps ❤️❤️❤️

  • @zebra-er6xc
    @zebra-er6xc20 күн бұрын

    koi iska bfs code share kardo and explaination bhi

  • @HossainAhmedSiam-ot5jr
    @HossainAhmedSiam-ot5jr21 күн бұрын

    solved it myself. but waiting for you..🇧🇩

  • @codestorywithMIK

    @codestorywithMIK

    21 күн бұрын

    ❤️❤️

  • @HossainAhmedSiam-ot5jr

    @HossainAhmedSiam-ot5jr

    21 күн бұрын

    @@codestorywithMIK sir, now i can understand hindi well, only for you.

  • @codestorywithMIK

    @codestorywithMIK

    21 күн бұрын

    This means a lot me ❤️❤️❤️ So glad to hear this 🙏❤️

  • @HossainAhmedSiam-ot5jr

    @HossainAhmedSiam-ot5jr

    21 күн бұрын

    ​@@codestorywithMIK thanks sir ❤️❤️❤️

  • @aizad786iqbal
    @aizad786iqbal19 күн бұрын

    this is not a graph question so how can we know when to apply bfs and dfs.. also for bfs, how would we approach here, please provide a hint.. I am a bit confused

  • @aizad786iqbal

    @aizad786iqbal

    19 күн бұрын

    we won't have recursion in bfs?

  • @Mercer_077
    @Mercer_07720 күн бұрын

    Can we solve this problem using dynamic programming?

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    For a given cell [i][j] , we can have different values depending on the cell from where you started your DFS. so you can’t store any past result in a dp array i.e. you can’t memoize or use previous results to solve your current result. Hence you can’t use DP in such cases.

  • @molyoxide8358
    @molyoxide835821 күн бұрын

    Bro Bit Manipulation playlist bhi bana start kr do

  • @codestorywithMIK

    @codestorywithMIK

    21 күн бұрын

    Let me start that soon. Currently very occupied in some project ❤️😇

  • @molyoxide8358

    @molyoxide8358

    21 күн бұрын

    @@codestorywithMIK Okay brother.

  • @dipeshsaili4468
    @dipeshsaili446820 күн бұрын

    BFS toh main tha sirji

  • @dhairyachauhan6622
    @dhairyachauhan662220 күн бұрын

    i was wondering why we didn't get TLE , 4^25 >>>>> 10^8(1s), usually we get tle.

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    I also wondered the same. I believe leetcode test cases for this is not strong enough.

  • @adityakurhade1531

    @adityakurhade1531

    20 күн бұрын

    This observation initially made me think of a DP solution, but I couldn't come up with one because maintaining a visited state in an integer value is not possible for a 15x15 matrix. The other option is to take the DP state as dp[r][c][visited[]], which seems like overkill. I wonder if we can solve this in an even more optimized way, perhaps by using a different form of DP

  • @dhairyachauhan6622

    @dhairyachauhan6622

    19 күн бұрын

    @@adityakurhade1531 making a vector as a state is kinda pointless, coz 99% of the the you will never visit that state ig.

  • @kaustubhchaudhari9838
    @kaustubhchaudhari983820 күн бұрын

    Hi Mik Bhai, please upload Java SOLUTION TOO*

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    Yes, let me update java after my office hours ❤️

  • @Coder_Buzz07
    @Coder_Buzz0720 күн бұрын

    bhaiya apka dsa sheet pls update kardoo bht dino se pending hai

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    Let me update it this weekend . Have been very busy with office projects lately ❤️

  • @Coder_Buzz07

    @Coder_Buzz07

    20 күн бұрын

    Ohh i understand bhaiya take ur time and take care of ur health too

  • @ronakkriplani1838
    @ronakkriplani183820 күн бұрын

    can anyone tell me why we have passed address here &dire please tell with example anyone for (auto &dire : directions) { cout

  • @Ronakrewar
    @Ronakrewar20 күн бұрын

    isme dp nhi laega kya?

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    For a given cell [i][j] , we can have different values depending on the cell from where you started your DFS. so you can’t store any past result in a dp array i.e. you can’t memoize or use previous results to solve your current result. Hence you can’t use DP in such cases.

  • @nish0798
    @nish079820 күн бұрын

    also bro I more doubts yaar ek baat samj nahi aatti recursive call karne ke bhi kayi ways but konsa kab use karna hai and inme farak kya hai x,y are paramters of call and c has result 1st case c+=fncall(x,y) c+=fnca(x,y); c+=fncall(x,y) c+=fnca(); 2nd case we dont use variable rather pass it as paramter fncall(x,y,c) fnca(x,y,c); fncall(x,y,c) fnca()x,y,c ); dono me fark kya hai how are the values updated in both the cases when rcursive call is made and when backtracking happens bro ye doubt please solve kardo kaafi confuse karta hai also try to cover this in your backtarckig video ki how values are getting updated in variable when recursion and backtrack happesn in both the cases PLZ REPLY

  • @Runigene
    @Runigene20 күн бұрын

    leetcode has updated the test cases now it is giving tle on same code after 51 test case

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    It’s passing for me. Can you share your code ?

  • @mehulthuletiya497
    @mehulthuletiya49720 күн бұрын

    class Solution { public: int getMaximumGold(vector& grid) { int m = grid.size(); int n = grid[0].size(); int maxGold = 0; function dfsBacktrack = [&](int i, int j, int currentGold) { if (i = m || j = n || grid[i][j] == 0) { return; } int goldInCurrentCell = grid[i][j]; currentGold += goldInCurrentCell; maxGold = max(maxGold, currentGold); int temp = grid[i][j]; grid[i][j] = 0; dfsBacktrack(i + 1, j, currentGold); dfsBacktrack(i - 1, j, currentGold); dfsBacktrack(i, j + 1, currentGold); dfsBacktrack(i, j - 1, currentGold); grid[i][j] = temp; }; for (int i = 0; i for (int j = 0; j if (grid[i][j] != 0) { dfsBacktrack(i, j, 0); } } } return maxGold; } }; // Matrix, Backtracking -- Array // TC: O(m * n * 4^max(m,n)) // SC: O(m * n)

  • @dreadpirateroberts3902
    @dreadpirateroberts390221 күн бұрын

    Moj masti

  • @SHIVAMOJHA21
    @SHIVAMOJHA2120 күн бұрын

    what is wrong in normal bfs approach?? can somebody explain with this code? class Solution: def getMaximumGold(self, grid: List[List[int]]) -> int: row = len(grid) col = len(grid[0]) ans = 0 dir = [(1 , 0) , (-1 , 0) ,(0 , 1) , (0 , -1)] for i in range(row): for j in range(col): if grid[i][j]: s = 0 visited = {(i , j)} queue = [(i , j , grid[i][j])] queue = deque(queue) while queue: r , c , cost = queue.popleft() ans = max(ans , cost) for x in dir: u = r+x[0] v = c+x[1] if 0

  • @vm0305

    @vm0305

    20 күн бұрын

    Even I want to know that too. Applied similar BFS approach in java

  • @yashdevtiwari2898
    @yashdevtiwari289820 күн бұрын

    time limit exceeded after 51 test cases

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    Please share your code.

  • @yashdevtiwari2898

    @yashdevtiwari2898

    20 күн бұрын

    @@codestorywithMIK class Solution { public: int dfs(vector& grid, int i, int j){ int m = grid.size(); int n = grid[0].size(); if(i>=m || i=n || j

  • @yashdevtiwari2898

    @yashdevtiwari2898

    20 күн бұрын

    @@codestorywithMIK class Solution { public: int dfs(vector& grid, int i, int j){ int m = grid.size(); int n = grid[0].size(); if(i>=m || i=n || j

  • @yashdevtiwari2898

    @yashdevtiwari2898

    20 күн бұрын

    class Solution { public: int dfs(vector& grid, int i, int j){ int m = grid.size(); int n = grid[0].size(); if(i>=m || i=n || j

  • @yashdevtiwari2898

    @yashdevtiwari2898

    20 күн бұрын

    @@codestorywithMIK shared on mail

  • @Rajat_maurya
    @Rajat_maurya20 күн бұрын

    what is wrong in this code class Solution { public: int dfs(int row, int col, vector &grid, vector &vis, int n, int m) { if(grid[row][col] == 0) return 0; vis[row][col] = 1; int sum = grid[row][col]; int a[] = {0, 0, 1, -1}; int b[] = {1, -1, 0, 0}; int val = 0; for(int i=0;i= 0 && nrow = 0 && ncol { int a = dfs(nrow, ncol, grid, vis, n, m); val = max(val, a); } } return sum + val; } public: int getMaximumGold(vector& grid) { int n = grid.size(), m = grid[0].size(); int ans = 0; for(int i=0;i

  • @vibhanshusharma9143
    @vibhanshusharma914321 күн бұрын

    More redable code but TLE why class Solution { public: bool possible(int r, int c, int n, int m) { if (r >= 0 && r = 0 && c return true; return false; } void dfs(vector& grid, int& ans, int& curr_sum, vector& visited, int r, int c) { visited[r][c] = 1; curr_sum += grid[r][c]; ans = max(ans, curr_sum); vector dir = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; for (vector& vec : dir) { int nr = r + vec[0]; int nc = c + vec[1]; if (possible(nr, nc, grid.size(), grid[0].size()) && grid[nr][nc] != 0 && !visited[nr][nc]) { dfs(grid, ans, curr_sum, visited, nr, nc); } } curr_sum -= grid[r][c]; visited[r][c] = false; return; } int getMaximumGold(vector& grid) { int ans = 0; int curr_sum = 0; int n = grid.size(), m = grid[0].size(); vector visited(n, vector(m, 0)); for (int i = 0; i for (int j = 0; j if (grid[i][j]) { dfs(grid, ans, curr_sum, visited, i, j); } } } return ans; } plz help me :(

  • @ManojKrVerma-vw4dx
    @ManojKrVerma-vw4dx20 күн бұрын

    @codestorywithMIK where is the fault in my code ? class Solution { public: int dirs[4][2] = {{-1,0},{1,0},{0,-1},{0,1}}; bool oom(int i, int j, int row, int col) { if (i = row || j = col) return true; return false; } int dfs(int sR, int sC, vector& grid, vector& vis, int row, int col) { if (oom(sR, sC, row, col)) return 0; vis[sR][sC] = 1; int gold = grid[sR][sC]; for (int i = 0; i int nX = sR + dirs[i][0]; int nY = sC + dirs[i][1]; if (oom(nX, nY, row, col) == 0 and grid[nX][nY] != 0 and vis[nX][nY] == -1) { gold += dfs(nX, nY, grid, vis, row, col); } } return gold; } int getMaximumGold(vector& grid) { int rows = grid.size(); int cols = grid[0].size(); vector vis(rows, vector(cols, -1)); int max_gold = INT_MIN; for(int i = 0; i for(int j = 0; j if (grid[i][j] > 0) { for (int m = 0; m for(int n = 0; n vis[m][n] = -1; int temp_gold = dfs(i, j, grid, vis, rows, cols); max_gold = max(max_gold, temp_gold); } } } return max_gold; } };

  • @ManojKrVerma-vw4dx

    @ManojKrVerma-vw4dx

    20 күн бұрын

    I got it... class Solution { public: int dirs[4][2] = {{-1,0},{1,0},{0,-1},{0,1}}; bool oom(int i, int j, int row, int col) { if (i = row || j = col) return true; return false; } int dfs(int sR, int sC, vector& grid, vector& vis, int row, int col) { if (oom(sR, sC, row, col)) return 0; vis[sR][sC] = 1; int gold = grid[sR][sC]; int maxx_gold_among_all_dirs = 0; for (int i = 0; i int nX = sR + dirs[i][0]; int nY = sC + dirs[i][1]; if (oom(nX, nY, row, col) == 0 and grid[nX][nY] != 0 and vis[nX][nY] == -1) { maxx_gold_among_all_dirs = max(maxx_gold_among_all_dirs, dfs(nX, nY, grid, vis, row, col)); } } vis[sR][sC] = -1; return gold + maxx_gold_among_all_dirs; } int getMaximumGold(vector& grid) { int rows = grid.size(); int cols = grid[0].size(); vector vis(rows, vector(cols, -1)); int max_gold = 0; for(int i = 0; i for(int j = 0; j if (grid[i][j] > 0) { for (int m = 0; m for(int n = 0; n vis[m][n] = -1; int temp_gold = dfs(i, j, grid, vis, rows, cols); max_gold = max(max_gold, temp_gold); } } } return max_gold; } };

  • @Arin9626
    @Arin962620 күн бұрын

    Can you upload shorter videos. Not by skipping important points but by teaching fast. I mean I understand that slow and long videos usually help to best understand the concept. Students might have more time but what about working professionals in software industry preparing for interviews to switch jobs ? They might not have 1 hour for understanding a single problem and probably might not even need such an jn depth explanation because they are not beginners. Look at another channel Techdose. He teaches fast and has shorter videos. But his videos are still helpful.

  • @codestorywithMIK

    @codestorywithMIK

    20 күн бұрын

    Hi there, I totally understand your concern and I agree my videos a little lengthy. Actually the main purpose of this channel was to help beginners because i saw a lot of beginners getting trapped in high paid courses. So it was one of the motivations for starting this. Being a professional I totally understand that taking out time for DSA is really tough. May be I can try to create a separate channel where I can teach a little fast which will be mainly for experts or experienced candidates. Kindly suggest me more ideas on what will be the best solution to this. Thank you for raising this ❤️❤️❤️

  • @ronakkriplani1838

    @ronakkriplani1838

    20 күн бұрын

    @@codestorywithMIK sir please dont reduce time keep doing whatever you're doing if they want fast they can watch it at 2x or 1.5x

  • @subhamcoder
    @subhamcoder20 күн бұрын

    why is it giving WA class Solution { public: int f(int i,int j,vector g){ int n=g.size(); int m= g[0].size(); if(i=m)return 0; if(i==n-1)return g[i][j]; if(g[i][j]==0)return -1e9; if(g[i][j]==-1)return 0; int x=g[i][j]; g[i][j]=-1; int up=x+f(i-1,j,g); int down=x+f(i+1,j,g); int right=x+f(i,j+1,g); int left= x + f(i,j-1,g); return max({up,down,left,right}); } int getMaximumGold(vector& g) { int n=g.size(); int m= g[0].size(); int ans=0; for(int i=0;i

  • @detaincoder
    @detaincoder21 күн бұрын

    here is bfs code but after passing 35,36 test case memory limit exceed class Solution { public: // int DFS(vector& grid,int i , int j){ // int m = grid.size(); // int n = grid[0].size(); // if(i >= m || i= n || j= m || y = n || grid[x][y] == 0) { continue; } int originalGoldValue = grid[x][y]; grid[x][y] = 0; int up = bfs(grid, x - 1, y); int down = bfs(grid, x + 1, y); int left = bfs(grid, x, y - 1); int right = bfs(grid, x, y + 1); grid[x][y] = originalGoldValue; maxGold = max(maxGold, originalGoldValue + max({up, down, left, right})); } return maxGold; } int getMaximumGold(vector& grid) { int m = grid.size(); int n = grid[0].size(); int maxGold = 0; for(int i =0;i

  • @ugcwithaddi
    @ugcwithaddi21 күн бұрын

    I solved on my own. Yay 🥹🥹🥹

  • @Sumit-wy4zp

    @Sumit-wy4zp

    21 күн бұрын

    Me too

  • @codestorywithMIK

    @codestorywithMIK

    21 күн бұрын

    Awesome 😇