Same Tree

Sdílet
Vložit
  • čas přidán 30. 06. 2024
  • For business inquiries email partnerships@k2.codes Discord: bit.ly/K2-discord
  • Věda a technologie

Komentáře • 57

  • @KevinNaughtonJr
    @KevinNaughtonJr  Před 5 lety +21

    11 DAYS TILL GAME OF THRONES IF YOU DON'T WATCH EITHER START OR LOSE MY NUMBER

  • @aydasu
    @aydasu Před 5 lety +17

    Kevin, this is no joke, but found your channel at a time that i needed to sharpen my interview skills so bad and have been following you for a while now. I honestly could not have been so disciplined on leetcode if i did not find your channel. I always try to drop a comment but this time wanted to truly thank you.

    • @KevinNaughtonJr
      @KevinNaughtonJr  Před 5 lety +4

      Thank you so much that means so much to me I really appreciate it! Stick with it it'll pay off in the end!!!

  • @salonigupta1175
    @salonigupta1175 Před 5 lety +3

    I just love the background music and the styling of your videos. great job!

    • @KevinNaughtonJr
      @KevinNaughtonJr  Před 5 lety +2

      Thanks so much Saloni I really appreciate the support!!!

  • @thecheekychinaman6713
    @thecheekychinaman6713 Před 4 lety +1

    Had this asked in an interview just now. A variation about similarity (nodes can be swapped). Forgot to code in the half-swapped cases, but thats life! Thanks Kevin!

  • @mashak3765
    @mashak3765 Před 3 lety

    thank you for your clear walk throughs on these challenges. great help!

  • @janmichaelaustria620
    @janmichaelaustria620 Před 4 lety +1

    This was so enlightening. When you were explaining the base case, recursion suddenly clicked! Thanks Kevin!

  • @MrsMalinaM
    @MrsMalinaM Před 4 lety +2

    I have a phone google interview in an hour and I wish I found your channel a few months ago... Thank you for this awesome content. You are the best at explaining concepts! You make it look very easy:)

    • @KevinNaughtonJr
      @KevinNaughtonJr  Před 4 lety +5

      Thanks so much Marina and best of luck on your phone screen! Let me know how it goes! A couple last minute tips if you’re interested...
      1. Don’t do anything until you understand the problem entirely!
      2. Ask clarifying questions - companies want to see you think before you code and think about edge cases!
      3. Once you finish writing you code don’t assume it’s right! Run a couple test cases on it if possible as well as talk through the logic of your code line by line out loud (it’s like proof reading an essay, if there’s a mistake chances are you’ll catch it while reading out loud)
      4. Be confident you can do this!!!!

    • @thecheekychinaman6713
      @thecheekychinaman6713 Před 4 lety +1

      @@KevinNaughtonJr The fact that you take the time to reply to these comments made me subscribe. New to this myself, in a way it kind of feels like doing your SATs, in that you try to recognize the type of problem, and apply a solution.

  • @arafatkhan5489
    @arafatkhan5489 Před 3 lety

    Keep up the good work ma man, you helping a lot of us out here ✌

  • @saloneerege2006
    @saloneerege2006 Před 5 lety +11

    Only if I could solve problems during an interview this easily. So difficult to remain calm during an interview
    :-(

    • @KevinNaughtonJr
      @KevinNaughtonJr  Před 5 lety +2

      It's tough Salonee, don't beat yourself up, just keep practicing! :)

  • @binbinzhou
    @binbinzhou Před 5 lety +4

    Love the reference to StackOverflow w/ logo!

  • @yicai7
    @yicai7 Před 4 lety

    Thanks Dude!
    Still remember the scenario that "Recursion just like you are watching a movie in the cinema "

  • @bokams3385
    @bokams3385 Před 4 lety

    I like ur presentation skills ,simply superb keep rocking

  • @Randomisticful
    @Randomisticful Před 2 lety

    Hate these kinds of problems from the bottom of my heart. Don't even have a motivation to read the problem when I see Node, List etc.

  • @nedwilliams8806
    @nedwilliams8806 Před 3 lety

    your channel is dope brother, thanks a lot

  • @ganeshbirajdar4382
    @ganeshbirajdar4382 Před 2 lety

    Thanks for the video. Helpful 👍

  • @kalyanimeshram7669
    @kalyanimeshram7669 Před 2 lety

    simple and understandable , thanks.

  • @anthonycheng12
    @anthonycheng12 Před 5 lety +10

    Hey Kevin love the videos can you do more leetcode mediums I feel like in interviews I never encounter easy problems it’s always mediums

  • @surekhak3874
    @surekhak3874 Před 5 lety +1

    Hi, Thank you for your videos. It's been extremely helpful. Can you please make an video on Lettcode#498. Diagonal traversal.

    • @KevinNaughtonJr
      @KevinNaughtonJr  Před 5 lety

      Anytime and thanks for the suggestion I'll see what I can do!

  • @justinf7438
    @justinf7438 Před 5 lety

    Nice Video, What made you choose software engineering as your career path?

    • @KevinNaughtonJr
      @KevinNaughtonJr  Před 5 lety +1

      Thanks Spark! I just liked video games when I was younger so I was interested in programming so I gave it a shot in college and loved it

  • @FrankLi92
    @FrankLi92 Před 5 lety

    Hey Kevin, can you do "All Possible Full Binary Trees" on LC when you get a chance? There aren't many good solutions on LC and no one really has done a video on this problem before. It's an interesting problem, but I can't grasp the concept because it's recursive heavy and I think has some DP mixed in?

  • @rajasanchit
    @rajasanchit Před 4 lety

    What is the space complexity for this recursion method?

  • @Garensonic
    @Garensonic Před 5 lety +3

    Tree problems we're what stumped me during my Amazon interview a few months ago (can't give the exact problems due to NDA)

  • @HARIHaran-ks7wp
    @HARIHaran-ks7wp Před 3 lety

    The Game of Thrones excitement didn't age well 😂😂😂

  • @hozher
    @hozher Před 5 lety

    How many tries did you do?

  • @nealpatel7696
    @nealpatel7696 Před 5 lety +1

    So glad you mentioned runtime. I actually followed the solution this time haha.

    • @KevinNaughtonJr
      @KevinNaughtonJr  Před 5 lety

      Haha I FINALLY remembered!!! Awesome I'm happy to hear the solution made sense :)

    • @nealpatel7696
      @nealpatel7696 Před 5 lety

      @@KevinNaughtonJr I actually had a question to ask! I recently came across it in a coding challenge. If we're given an array where each item in the array is a fountain and max a fountain can spray (its range) is min(i + a[i], n) where n is the length of the array, what is the minimum number of fountains needed to be turned on to cover the entire array? An example is [1, 1, 1, 2, 3, 1, 1, 1], n = 8 and the answer would be one since the 4th index i = 3 would give 3 + 2 = 5 and 5 on each side would cover the entire array. I have no clue on how to approach this and have been racking my brain. I know it requires a dp solution as it's very similar to the tower hop problem or the min number of jumps problem.

  • @harinijeyaraman8789
    @harinijeyaraman8789 Před 4 lety

    Please make more videos on Dynamic Programming !

  • @dumbfailurekms
    @dumbfailurekms Před rokem

    who was google asking same tree to? the service dogs ??

  • @vikramreddy7586
    @vikramreddy7586 Před 4 lety

    Trees solutions with recursion are pretty trivial, we should concentrate more using Stacks or Queues for solving the tree problems, and that's what the interviewer expects. Gave an onsite interview with one of the BIG 5 and first thing the interviewer tells you with tree problems is "No Recursive Solution Please !". Please don't block me. :)

  • @Garensonic
    @Garensonic Před 5 lety

    Also do you know if there is an iterative solution to this problem

    • @KevinNaughtonJr
      @KevinNaughtonJr  Před 5 lety

      You can always write thing iteratively or recursively!

  • @ZenNoah
    @ZenNoah Před 5 lety

    Good shit bro, have a coding challenge to do from Google, hope it's not too bad

    • @KevinNaughtonJr
      @KevinNaughtonJr  Před 5 lety

      Thanks man really appreciate it! Good luck and lmk if there's anything I can do to help you prepare, you got this!!!

  • @nknidhi321
    @nknidhi321 Před 3 lety

    You make it super easy..❤️

  • @karlwhitford7523
    @karlwhitford7523 Před 2 lety

    Thanks

  • @rahmabader1627
    @rahmabader1627 Před 3 lety

    Kevin , i want is to give me exemple of param TreeNode p and q to pass it through isSameTree(p, q) function to excute it in other IDE THanks

  • @thetechthirsty713
    @thetechthirsty713 Před 4 lety

    U r GOD!

  • @AmanMishra-im6sh
    @AmanMishra-im6sh Před 3 lety

    Fabb...

  • @dev-skills
    @dev-skills Před 3 lety

    Same logic could be simply more compactly written as below
    ```
    public boolean isSameTree(TreeNode p, TreeNode q) {
    if ((p == null) && (q == null)) return true;
    if ((p == null) || (q == null)) return false;
    return (p.val != q.val) ? false : isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
    }
    ```

  • @vk1618
    @vk1618 Před 4 lety

    Nice use of else if for implementing logic

  • @dineshkoya2291
    @dineshkoya2291 Před 3 lety

    do more problems on graphs and bit manipulation , i have learnt the implementation concept of trees from your videos only

  • @justinrblx9844
    @justinrblx9844 Před 5 lety

    Hello! My dream is to become a software engineer in the future.

  • @kumaransg1828
    @kumaransg1828 Před 5 lety

    Wrong link to problem, fix it kevin