Burning Tree | Very Important Question For Amazon | Geeks For Geeks Solution in Hindi

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ธ.ค. 2024

ความคิดเห็น • 26

  • @shubhamrao5952
    @shubhamrao5952 3 ปีที่แล้ว +18

    Really it is very important questions..This question was asked by Paytm in my second technical interview round ..And I could not answer it properly..After that I again saw this question in online coding test of Box8.

    • @kautukdwivedi
      @kautukdwivedi 3 ปีที่แล้ว +3

      kaffi common question ha
      asked multiple times in amazon
      Sometimes they ask to print order of burning too.

    • @chirayubaliyan5181
      @chirayubaliyan5181 2 ปีที่แล้ว

      @@kautukdwivedi How to print order? Like for node at K distance away it is easy to return the answer array but how to do in this? can you provide the code?

  • @mayur_madhwani03
    @mayur_madhwani03 2 ปีที่แล้ว +3

    Explanation of last question was so good that I solved this problem on my own

    • @Pepcoding
      @Pepcoding  2 ปีที่แล้ว

      Glad it helped!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @kautukdwivedi
    @kautukdwivedi 3 ปีที่แล้ว +1

    Worst Case Complexity: O(2n).
    If burningNode present as rightmost leave.

  • @abhinavgarg7654
    @abhinavgarg7654 2 ปีที่แล้ว

    what is the time complexity of this approach?????

  • @AbhishekJha-wm5oq
    @AbhishekJha-wm5oq 3 ปีที่แล้ว

    Why can't we use bfs here? I mean keep storing the next set of nodes in a queue with time. It's easy like this.

    • @arstheking6633
      @arstheking6633 3 ปีที่แล้ว

      But for storing the parent node, we'll have to use hashmap don't we ??

    • @shubhamlahoti9758
      @shubhamlahoti9758 3 ปีที่แล้ว

      here, we only need to find the farthest node from the node i, if we had to print the nodes burnt in order, then bfs would have been useful.

  • @peterbarter4647
    @peterbarter4647 3 ปีที่แล้ว +1

    Intro 😍

  • @HarshKumar-nh6be
    @HarshKumar-nh6be 2 ปีที่แล้ว +1

    Thanks!!!!!! 🤩🤩

    • @Pepcoding
      @Pepcoding  2 ปีที่แล้ว

      Hope you like the video,
      For better experience and precisely arranged videos sign up on nados.io

  • @rohit8021
    @rohit8021 2 ปีที่แล้ว

    doing it own after solving k nodes

    • @Pepcoding
      @Pepcoding  2 ปีที่แล้ว

      Hope you like the video.
      For better experience and well organised content sign up on nados.io
      Don't forget to follow us on Instagram instagram.com/pepcoding/

  • @mrinmoyaus761
    @mrinmoyaus761 3 ปีที่แล้ว

    Blocknode return

  • @sumandas829
    @sumandas829 3 ปีที่แล้ว

    We have to find out the longest path from current node to leaf node . Thats all

    • @arstheking6633
      @arstheking6633 3 ปีที่แล้ว

      But if the given node is itself a leaf node then ?

  • @LegitGamer2345
    @LegitGamer2345 3 ปีที่แล้ว

    halwa question after solving all nodes k distance away

  • @shub07s
    @shub07s 3 ปีที่แล้ว +1

    1 2 3 4 5 N 6 N N 7 8 N 9 N N N N N 10
    target : 1
    this test case faild on gfg. same code passed on pepcoding but not on gfg

    • @HarshKumar-nh6be
      @HarshKumar-nh6be 2 ปีที่แล้ว

      Is it solved??

    • @jagriti2978
      @jagriti2978 2 ปีที่แล้ว +1

      Geeks for geeks has buggy software. When I ran the same as custom input it showed correct answer

    • @kartikpant5983
      @kartikpant5983 2 ปีที่แล้ว +2

      Try initializing the maxTime = 0 before calling the burningTree_ everytime. It will work.

    • @e431215
      @e431215 2 ปีที่แล้ว +4

      It's because static global variable retains it's memory when tests are run in sequence. That's the reason same test will pass when run alone.
      You can initialize maxTime=0 (at line 52 according to above code), before giving a call to burningTree_