Same Tree | LeetCode 100 | C++, Java, Python

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

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

  • @agileprogramming7463
    @agileprogramming7463 4 года назад +5

    One of the rare occasions when I did a recursive problem by myself!!
    Also I had exact same solution as sir
    This is one of the most intuitive DFS problems out there.

  • @raviashwin1157
    @raviashwin1157 4 года назад +1

    Brilliantly done

  • @siddharthsingh4330
    @siddharthsingh4330 4 года назад +3

    sir please can you solve more of graph problems? I have my Campus selection starting from next month and I'm weak in Graphs.

    • @raviashwin1157
      @raviashwin1157 4 года назад

      Bhai campus placement me k liye college ka khulna bhi to zarrori hain

    • @siddharthsingh4330
      @siddharthsingh4330 4 года назад

      ravi ashwin virtual chal raha hai bhai

  • @Anonymous-ny1yy
    @Anonymous-ny1yy 4 года назад +1

    Great

  • @srikantsharma6430
    @srikantsharma6430 4 года назад +1

    Nice explanation.

  • @AlokKumar-jh8wp
    @AlokKumar-jh8wp 4 года назад +1

    Nice explanation sir

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

    Do they ask to solve in iterative way? it doesn't even seem efficient?

  • @prabhatchanchal
    @prabhatchanchal 4 года назад +1

    sir please make more make videos on graphs than leetcode.

  • @consistentthoughts826
    @consistentthoughts826 4 года назад +1

    What is meant by self.isSameTree
    Why are we using self here
    Please anyone explain

    • @KnowledgeCenter
      @KnowledgeCenter  4 года назад

      'self' refers to an instance/object of a class, and whatever we do with self. (dot after self), it accesses attributes and functions specific to that instance of the class.
      Let's say we have a class ABC.
      class ABC:
      def __init__(self, n):
      self.name = n
      def print_name(self):
      print(self.name)
      We create 2 instances of same class:
      a = ABC("obj1")
      b = ABC("obj2")
      a.print_name() # It will print obj1
      b.print_name() # It will print obj2
      So, inside the 2 calls of print_name() 'self 'is denoting instances a and b respectively.

  • @fahmidhossainSakib
    @fahmidhossainSakib 2 года назад

    Didn't understand the iterative approach at all !