Find Bottom Left Tree Value | 3 Approaches | Simple Story | Microsoft | Leetcode 513
Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A
This is the 41st Video of our Playlist "Binary Tree : Popular Interview Problems".
In this video we will try to solve a very good Binary Tree problem : Find Bottom Left Tree Value | Leetcode 513
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY.
We will do live coding after explanation and see if we are able to pass all the test cases.
Also, please note that my Github solution link below contains both C++ as well as JAVA code.
Problem Name : Find Bottom Left Tree Value | 3 Approaches | Simple Story | Microsoft | Leetcode 513
Company Tags : Microsoft
My solutions on Github(C++ & JAVA) : https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Tree/Find%20Bottom%20Left%20Tree%20Value.cpp
Leetcode Link : https://leetcode.com/problems/find-bottom-left-tree-value/
My DP Concepts Playlist : https://youtu.be/7eLMOE1jnls
My Graph Concepts Playlist : https://youtu.be/5JGiZnr6B5w
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Subscribe to my channel : https://www.youtube.com/@codestorywithMIK
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK
Approach Summary :
Approach-1 (Using DFS)
Time Complexity (T.C): O(n)
Space Complexity (S.C): O(max depth of tree)
The depth-first search (DFS) approach uses recursion to traverse the tree and find the bottom-left value. It maintains the maximum depth encountered and updates the bottom-left value accordingly.
Approach-2 (Using BFS)
Time Complexity (T.C): O(n)
Space Complexity (S.C): O(n) for the queue
The breadth-first search (BFS) approach uses a queue to traverse the tree level by level. It updates the bottom-left value during the traversal, ensuring that the last processed node on the bottom-left is returned as the result.
Approach-3 (Using BFS with inner while loop)
Time Complexity (T.C): O(n)
Space Complexity (S.C): O(n) for the queue
This variation of the BFS approach uses an inner while loop to process nodes level by level. It ensures that only the leftmost node at each level is considered for updating the bottom-left value, providing an alternative implementation to the basic BFS approach.
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
✨ Timelines✨
00:00 - Introduction
00:55 - Approach-1 (DFS)
07:04 - Coding Approach-1 DFS
09:01 - Approach-2 (BFS - I)
14:07 - Approach-3 (BFS- II)
21:36 - Coding Approach-2 and Approach-3 (BFS - I)
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #2024 #newyea