Find Edges in Shortest Paths | Dijkstra's Algo | Full Intuition | Leetcode 3123 | codestorywithMIK

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 36

  • @codestorywithMIK
    @codestorywithMIK  6 месяцев назад +6

    Correction : Time complexity of Dijkstra is O(ElogV) . My bad for the silly 😅

  • @Its_Shubham_Negi
    @Its_Shubham_Negi 14 дней назад +1

    BHAIYA THIS IS TOO AWESOME!!! HOW CAN SOMEONE TEACH SOOO GR8 😍

  • @cricketsureshlucky
    @cricketsureshlucky 6 месяцев назад +13

    Sir please upload 3rd one I have tried greedy it is too confusing

    • @rajkansagra2208
      @rajkansagra2208 6 месяцев назад

      i think greedy will fail. dp will be used

    • @EB-ot8uu
      @EB-ot8uu 6 месяцев назад

      I solved using dp.

  • @abhijeetsankala2648
    @abhijeetsankala2648 4 месяца назад +1

    First 10 minutes are enough to solve the problem, thanks 😊

  • @abhinavnarang4369
    @abhinavnarang4369 4 месяца назад +1

    We can also do this by maintaining a Parent array, and storing min path for every node, and then for the query just search if that edge is present in our array

  • @abhisheksinghrajput2624
    @abhisheksinghrajput2624 6 месяцев назад +1

    Awesome

  • @EB-ot8uu
    @EB-ot8uu 6 месяцев назад +1

    I could not solve this due to time but now I think I could have solved it by making 1-2 mistakes. thank you so much for improving my dsa. I am finally now able to solve 2-3 qns in leetcode contests

  • @manishjoshi9737
    @manishjoshi9737 6 месяцев назад

    amazing explaination as usual

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 6 месяцев назад +1

    oneof the best explanation so far.🎉❤

  • @souravjoshi2293
    @souravjoshi2293 6 месяцев назад

    bhai legend ho tum

  • @prath04
    @prath04 6 месяцев назад

    Minimum Number of Operations to Satisfy Conditions Sir please make video on this one
    and yeah thanks to you i was able to solve 4rth question in todays contest for the first time ever

  • @rajkansagra2208
    @rajkansagra2208 6 месяцев назад +1

    Can you make video on this question with second approach using parent vector.

  • @AnilShinde-s2o
    @AnilShinde-s2o 6 месяцев назад +2

    Plz solve The latest time to catch a bus using BINARY SEARCH approach.
    Leetcode problem no.2332

  • @DevOpskagyaan
    @DevOpskagyaan 6 месяцев назад +1

    Legend for a reason. 🔥🔥
    Qn-4 made halwa

  • @tutuimam3381
    @tutuimam3381 6 месяцев назад

    Amazing ❤❤❤❤❤❤❤

  • @AnkitSingh-tm5dp
    @AnkitSingh-tm5dp 6 месяцев назад +1

    Sir i have new doubth
    1254. Number of Closed Islands
    This code is work but if i change the dfs to logic for 4 direction and do nothing why it give wrong answer:
    class Solution {
    public:
    bool dfs(int i,int j,vector &grid){
    if(i=grid.size() || j>=grid[0].size()) return false;
    if(grid[i][j]==1 || grid[i][j]==2) return true;
    grid[i][j]=2; //when i found 0;
    bool down = dfs(i+1,j,grid);
    bool right = dfs(i,j+1,grid);
    bool up = dfs(i-1,j,grid);
    bool left = dfs(i,j-1,grid);
    return down && right && up && left;
    }
    int closedIsland(vector& grid) {
    int n = grid.size();
    int m = grid[0].size();
    int cnt=0;
    for(int i=0;i

  • @dyashwanth9822
    @dyashwanth9822 6 месяцев назад

    Thank You so much bhai ❤❤

  • @BiswajitRout-dl5ry
    @BiswajitRout-dl5ry 6 месяцев назад +2

    bhaiya apke tarha story ko code mai badlne practice kaise kare please bhaiya share some way to do so.

  • @suyashjain3223
    @suyashjain3223 6 месяцев назад

    Great Explanation sir!! Just one doubt i think Time complexity of Dijikstra is O(E*logV) and Not O(V+E).

    • @codestorywithMIK
      @codestorywithMIK  6 месяцев назад +2

      Ah so sorry. My bad for this silly.
      I added the correction in my Pinned Comment.
      Thanks a lot ❤️❤️

  • @technologicalvivek7510
    @technologicalvivek7510 6 месяцев назад

    bhaiya third question dp ke alwa koi aur approach se solve ho sakta hai kya .Agar ha toh Please ispar video bana dijiye.

  • @aaditibisht3418
    @aaditibisht3418 6 месяцев назад

    weekly contest 394 question 3 ka bhi sol upload kardo pls...

  • @harshtiwari416
    @harshtiwari416 6 месяцев назад

    bhai yeh jo apne visited se dijkstra ko optimize kra hai usse thoda aur explain kr skte ho??? yeah dijkstra ka part 3 video banaoge???

  • @hemendragour8776
    @hemendragour8776 6 месяцев назад +1

    bhaiya aapne jo java bala code he usme one test case pass nhi ho raha he aap ek bar chek kar lijiye;

    • @codestorywithMIK
      @codestorywithMIK  6 месяцев назад

      Corrected.
      Thanks a lot for pointing it out

  • @ayushchopra2282
    @ayushchopra2282 6 месяцев назад +1

    Sir can you please share your dsa sheet ?

    • @codestorywithMIK
      @codestorywithMIK  6 месяцев назад

      You can find the sheets link in this page -
      github.com/MAZHARMIK
      It has all details
      Thank you ❤️❤️

  • @anushkathakur6531
    @anushkathakur6531 6 месяцев назад

    bhaiya vo visited vala optimization dhang se samajh nhi aaya

    • @codestorywithMIK
      @codestorywithMIK  6 месяцев назад

      Actually it’s just used to avoid visiting an already visited node.
      You would not want to visit an already visited node.

    • @anushkathakur6531
      @anushkathakur6531 6 месяцев назад

      @@codestorywithMIK bhaiya,kabhi aap double dijkstra par video banao toh please yeh optimisation ka dry run bata dijiyega, mujhe doubt yeh hai ki agar vo node pehle visited toh Hui par kisi let say A node se vahan visit Kiya aur ab ki baar Jo visit kar rhe hai same node ko par hum kisi B node se vahan ke liye check kar rhe hain....

    • @codestorywithMIK
      @codestorywithMIK  6 месяцев назад

      Sure, I will cover that 👍🏻

  • @johnj171
    @johnj171 3 месяца назад

    god English please

  • @vibhanshusharma9143
    @vibhanshusharma9143 6 месяцев назад

    good bro