Same Tree (LeetCode 100) | Full solution with visuals and animations | Study Algorithms
Nikhil Lohia
View ChannelAbout
I want to share with you my knowledge, that I have gained all my life. I like to see every task in your day to day life as an interesting problem to solve, and if you can understand the requirements, solving for it can become somewhat intuitive. I try to explore certain aspects of day to day life and how I can make them easier for you. This involves daily hacks, tutorials, innovations, new discoveries, experiences and all the stuff I find amusing. As a software engineer myself, I also believe that good problem solving skills can help you overcome most of the barriers in life. Programming is one of them. If you know how to approach a problem, writing a code for it in any language could be a very typical task. With this channel I aim to focus on the way to solve a problem efficiently rather than just its implementation.
Latest Posts
Video Description
Two trees even if they are different can result in a same traversal result. This happens because of the non-linear structure of the tree data structure. A neat little trick can be applied to the level order traversal technique to determine if two trees are exactly the same. Watch this video to understand how you can take advantage of the actual structure of a tree node and arrive at a solution. Actual Problem: https://leetcode.com/problems/same-tree/ Chapters: 00:00 - Intro 00:52 - Problem Statement and Description 02:58 - What exactly are same trees? 05:50 - A trick with level order traversal 09:02 - Dry-run of Code 12:57 - Final Thoughts 📚 Links to topics I talk about in the video: LeetCode Problems: https://www.youtube.com/playlist?list=PLFdAYMIVJQHPaldBFQXzd59EiqfJTYkah Other easy problems: https://www.youtube.com/playlist?list=PLFdAYMIVJQHMap2jOyU6-kHjQEL-vxlV2 Level Order Traversal: https://youtu.be/9M3oCwPGamE Binary Tree: https://youtu.be/jxdEgfAsEg0 📘 A text based explanation is available at: https://studyalgorithms.com Code on Github: https://github.com/nikoo28/java-solutions/blob/master/src/main/java/leetcode/easy/SameTree.java Test-cases on Github: https://github.com/nikoo28/java-solutions/blob/master/src/test/java/leetcode/easy/SameTreeTest.java 📖 Reference Books: Starting Learn to Code: https://amzn.to/36pU0JO Favorite book to understand algorithms: https://amzn.to/39w3YLS Favorite book for data structures: https://amzn.to/3oAVBTk Get started for interview preparation: https://amzn.to/39ysbkJ 🔗 To see more videos like this, you can show your support on: https://www.buymeacoffee.com/studyalgorithms 🎥 My Recording Gear: Recording Light: https://amzn.to/3pAqh8O Microphone: https://amzn.to/2MCX7qU Recording Camera: https://amzn.to/3alg9Ky Tablet to sketch and draw: https://amzn.to/3pM6Bi4 Surface Pen: https://amzn.to/3pv6tTs Laptop to edit videos: https://amzn.to/2LYpMqn 💻 Get Social 💻 Follow on Facebook at: https://www.facebook.com/studyalgos Follow on Twitter at: https://www.twitter.com/studyalgorithms Follow on Tumblr at: https://studyalgos.tumblr.com/ Subscribe to RSS feeds: https://studyalgorithms.com/feed/ Join fan mail: http://eepurl.com/g9Dadv #leetcode #programming #interview
Master Coding Challenges
AI-recommended products based on this video

16.4Ft/5M Long USB C Cable, Durable USB A to USB C Charging and Data Sync Cord, Power Extension Cable for Any USB-C Enabled Security Cameras Phones Tablets Switch Pro Controller and More

Amazon Basics 256GB Ultra Fast USB 3.1 High Capacity Flash Drive for Fast Data Transfer and Storage, Black

2 Pack 32GB USB Flash Drive, 2.0 USB Stick Thumb Drive,Waterproof Function with Lanyard USB Memory Stick for Data Storage and Backup, Black




