Are these trees really the same?
In this video, we solve LeetCode 872 β Leaf-Similar Trees using a clean, step-by-step C++ approach.
Youβll learn how to compare two binary trees based on their leaf values β an elegant recursion and traversal problem!
π‘ Youβll discover:
β How to traverse both trees and extract their leaf sequences
β How to use vectors to store and compare leaves
β Why recursion and DFS make this problem simple and efficient
π― Perfect for those learning binary tree traversal and recursion logic in C++.
πΊ Watch now: https://youtu.be/YOUR-LINK-HERE
#LeetCode #Cplusplus #BinaryTree #Algorithms #DataStructures #CodingInterview #Recursion #LANAcademy @reper #foryou #viral #reper #urmaritori #for
Continue this lesson in the app
Install CourseHive on Android or iOS to keep learning while you move.
FAQs
We curate free YouTube courses, organized by category and language β and make it easy for you to track your learning progress.
Yes. Free courses are embedded YouTube videos.
Currently available in English β with Portuguese, Spanish, French, German, and Italian coming soon.
Check ratings, reviews, duration, and description.
All courses include a certificate of participation.
Yes, an account lets you track progress, earn certificates, and save favorites.
We auto-save your watch position so you can resume on any device.