LeetCode 1761. Minimum Degree of a Connected Trio in a Graph | Weekly Contest 228 | Algo Explained

Поділитися
Вставка
  • Опубліковано 18 лис 2024

КОМЕНТАРІ • 12

  • @ani68
    @ani68 2 роки тому +4

    Crystal clear explanation....I guess when who is complete begineer in graph can also easily understand this problem after watching this video💯💯🔥

  • @vikrantprasad7137
    @vikrantprasad7137 3 роки тому +1

    Subscribed ... Awesome explanation.!!

  • @cherrycodingiit-g9273
    @cherrycodingiit-g9273  3 роки тому

    Complete playlist : ua-cam.com/play/PLL1nj86QUnAzISikKTBGJTXGrSzvqnTBn.html

  • @deepikatadakhe
    @deepikatadakhe 2 роки тому

    I have a small doubt, why are we taking size of adjacency matrix as n+1 for n nodes?

    • @deepikatadakhe
      @deepikatadakhe 2 роки тому +1

      Figured out. Because acording to the constraints mentioned in the question edges start from 1 so there is no node for 0, so for 6 nodes we need matrix of size 7 ( for index 0 to 6).

  • @Mai_Bharatwaasi
    @Mai_Bharatwaasi 3 роки тому

    Thanks a lot :)

  • @janmejaysingh7402
    @janmejaysingh7402 3 роки тому +1

    The explanation is incomplete, it doesn't explain how we are avoiding overcounting an edge for cases like example 2, when the other edge is also a part of some other trio.

    • @cherrycodingiit-g9273
      @cherrycodingiit-g9273  3 роки тому +1

      That is why I have subtracted 6 while counting the degree of a trio. One node of a trio has 2 internal degrees so 3 will have 6 internal degrees. In this way I am avoiding overcounting of internal edges.
      In case some edge is a part of another trio, it still doesn't matter cuz all trio have to seen uniquely. So I will just count the degree of all nodes of that trio and subtract 6 from it. You can do a dry run and see this.
      I hope it will be clear ? ...feel free to ask if still any doubt.

    • @janmejaysingh7402
      @janmejaysingh7402 3 роки тому +1

      @@cherrycodingiit-g9273 I re-read the description and I realised that I had misunderstood the question.

    • @cherrycodingiit-g9273
      @cherrycodingiit-g9273  3 роки тому +1

      Glad... It was helpful. If this happens to be your 2nd or 3rd video on this channel plz consider subscribing it only takes a second and it really motivates me. If not it is fine 😊.