leetcode 2493 Divide Nodes Into the Maximum Number of Groups

Sdílet
Vložit
  • čas přidán 28. 07. 2024
  • Attention all problem solvers! Are you ready for a challenge? Leetcode's Weekly Contest 322 is here and it's time to put your skills to the test. The problem: "2493 Divide Nodes Into the Maximum Number of Groups." Sound daunting? Don't worry, we've got you covered with this editorial.
    With its tricky twists and turns, this problem is sure to keep you on your toes. But with a little bit of strategy and a lot of determination, you can solve it and come out on top. So why wait? Dive in and start tackling this problem today! You never know, you might just discover a new way to conquer it.
    Problem Link: leetcode.com/problems/divide-...
    Code Link: ideone.com/uQnQpn
    00:00 Understanding problem statement
    01:57 Approach
    13:20 Summarizing Approach
    14:47 Code
    Are you tired of failing coding interviews and missing out on your dream job at a top tech company? Look no further! Programming Pathshala's "Renaissance" online course is here to help you succeed. With a focus on mastering DSA, system design, and low-level design, our course will give you the skills and confidence you need to ace those coding interviews.
    And the best part? You can try it out for free with our 7-day trial. Don't miss out on this opportunity to finally land your dream job. Sign up now at renaissance.programmingpathsh...
    Don't just take our word for it. Check out the success stories of our students who have made it into top tech companies like Google and Microsoft, read their stories and see for yourself at renaissance.programmingpathsh....
    Don't wait any longer, start your journey to coding interview success with Programming Pathshala today!
    You can write to us at: info@programmingpathshala.com

Komentáře • 24

  • @proton3773
    @proton3773 Před 4 měsíci +1

    perfect way to explain this solution.

  • @gaureesha9840
    @gaureesha9840 Před 8 měsíci +1

    great explanation, thanks!

  • @YashSharma-nc5xu
    @YashSharma-nc5xu Před rokem +2

    Nicely explained, specially steps mentioned at last to solve this problem.

  • @rohitraj2321
    @rohitraj2321 Před rokem

    best explanation... ever

  • @p4r4d0x
    @p4r4d0x Před 11 měsíci

    You are a really talented teacher, very clear explanation, bravo

  • @gauravkungwani
    @gauravkungwani Před rokem +3

    from this video I got to know i can check for odd length cycle using bipartite code !! Thanks !!

  • @artistic__08
    @artistic__08 Před 9 měsíci

    This is a very good explanation, because usually people just tell the solution, but you walked us through the thought process that led to it, I am thankful for the insightful content, pls keep posting. Even if you are not getting views right now - i am sure ppl in need of good content will find this channel, good luck!

  • @shahrukhansari7806
    @shahrukhansari7806 Před rokem +1

    excellent explanation

  • @thakurvishwanathprasad5807

    Thanks bro

  • @anandhakrishnan4550
    @anandhakrishnan4550 Před rokem +1

    wonderful,please teach sir in regular class

  • @azizkamri8019
    @azizkamri8019 Před rokem +1

    nicely explained

  • @heroicrhythms8302
    @heroicrhythms8302 Před rokem

    you had the teaching skill in you !

  • @shivankitraghav
    @shivankitraghav Před rokem +1

    Great video bhaiya, extremely helpful

  • @kuvarpal6611
    @kuvarpal6611 Před rokem

    Good buddy keep it up

  • @artistic__08
    @artistic__08 Před 9 měsíci

    @15.57 , should it not be max of shortest distance to the farthest node for each connected component?

  • @girikgarg8
    @girikgarg8 Před rokem +1

    How is dfs function returning us the maximum number of groups?

    • @ProgrammingPathshala
      @ProgrammingPathshala  Před rokem +1

      We are using DFS to iterate over all the nodes in a connected component and to track the maximum value of the shortest path for the farthest node. We can iterate using BFS also.

    • @girikgarg8
      @girikgarg8 Před rokem

      @@ProgrammingPathshala Yes actually I was confused because in the video you had iterated through BFS. Anyways thanks!!

  • @stayfearless3847
    @stayfearless3847 Před rokem +1

    How is number of nodes from node 7 5 at time 11:11? I thought from node 7, we can get to node 1 by wrapping around. 7 -> 6 -> 3 -> 5 -> 4 -> 2 -> 1

    • @ProgrammingPathshala
      @ProgrammingPathshala  Před rokem

      We are calculating the shortest distance to the farthest node.

    • @stayfearless3847
      @stayfearless3847 Před rokem +1

      @@ProgrammingPathshala oh yes!! I totally missed this part. Thanks for clarifying

  • @girikgarg8
    @girikgarg8 Před rokem

    I didn't really get why you are using the dfs function...please let me know if anyone has implemented this psedudocode in actual code