filmov
tv
Most Profitable Path in a Tree | BFS | DFS | Detailed | Leetcode 2467 | codestorywithMIK

Показать описание
Hi Everyone, this is the 69th video of our Playlist "Graphs : Popular Interview Problems".
Now we will be solving a good Graph problem - Most Profitable Path in a Tree | BFS | DFS | Detailed | Leetcode 2467 | codestorywithMIK
Problem Name : Most Profitable Path in a Tree | BFS | DFS | Detailed | Leetcode 2467 | codestorywithMIK
Company Tags : Intuit
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Video Summary :
Approach-1 (DFS for Bob and DFS for Alice)
The idea is to first find Bob’s path to node 0 using DFS and store the time he takes to reach each node. Then, Alice starts her own DFS traversal from node 0, deciding how much profit she can collect based on whether she reaches a node before, after, or at the same time as Bob. The goal is to maximize Alice’s income when she reaches a leaf node.
Approach-2 (DFS for Bob and BFS for Alice)
Bob’s path to node 0 is determined using DFS, just like in the first approach. However, instead of DFS, Alice explores nodes using BFS, ensuring that she visits nodes in the shortest time possible while maximizing income. This approach effectively leverages queue-based traversal to efficiently process nodes level by level.
✨ Timelines✨
00:00 - Introduction
0:24 - Motivation
0:44 - Problem Explanation
9:50 - Thought Process and Intuition
22:11 - Story To Code
25:01 - Coding Approach-1 (DFS + DFS)
37:09 - Fixing important error
39:22 - Coding Approach-2 (DFS + BFS)
43:29 - Time Complexity
#MIK #mik #Mik
#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 #coding #programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience #pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview #interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding #hindiprogramming #hindiexplanation #hindidevelopers #hinditech #hindilearning #helpajobseeker #jobseekers #jobsearchtips #careergoals #careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent #socialmediagrowth #contentcreation #instagramreels #videomarketing #codestorywithmik #codestorywithmick #codestorywithmikc #codestorywitmik #codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik #codestorwithmik
Комментарии