Duplicate Subtrees | Binary Tree | GFG POTD | C++ | Java | Code Kar Lo

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

КОМЕНТАРІ • 12

  • @akhileshtiwari9218
    @akhileshtiwari9218 4 місяці тому

    nice approach to tackle the problem of same preorder of different subtrees. Thanks for providing the solution!

  • @amanrawat3194
    @amanrawat3194 4 місяці тому

    sir your videos are amazing. Your teaching style is very good.
    Sir can you please launch a series on trees?

    • @code_kar_lo
      @code_kar_lo  4 місяці тому +2

      Thanks a lot. Yes i will make a series in some days. Currently pattern series is going on you can watch that as well

  • @aizad786iqbal
    @aizad786iqbal 4 місяці тому

    thanks...
    1 - we can use set right instead of map?
    2 - space kyun add kara.... bina space ke bhi toh same hi chalna chayie ?
    note --- one suggestion, please use colors, as sometimes it gets messy..

    • @code_kar_lo
      @code_kar_lo  4 місяці тому +1

      Yes we can use set but i mostly prefer map 😅.
      Space i have added just to be in safer side i have said in the video as well that it can work without space as well
      Thanks for the suggestions

    • @aizad786iqbal
      @aizad786iqbal 4 місяці тому

      @@code_kar_lo i tried HashSet, but facing issue in duplicates... i tried to check if answer is present already then don't add but since and stores node and thus address isn't same and contains logic not working on the ans , i use Java

    • @code_kar_lo
      @code_kar_lo  4 місяці тому +1

      Yes if you are using set you the code will complex and you have to do multiple handilations

    • @kshitijkamble5816
      @kshitijkamble5816 4 місяці тому

      bro there is similar q on leetcode try to solve then yo will know why space required

  • @KishanSingh-vc3re
    @KishanSingh-vc3re 4 місяці тому

    you said its preordere, and then moved on to extreme left.

    • @code_kar_lo
      @code_kar_lo  4 місяці тому +1

      Preorder means first you will add node then left then right and you can see while making the string first i am adding node data then going on left then right

  • @devlpr-nitish
    @devlpr-nitish 4 місяці тому

    surkiya