Summary
Keywords
Full Transcript
In this video we solve LeetCode 399: βEvaluate Divisionβ using C++ and a clean graph + DFS/BFS approach. We are given equations like a / b = k and we need to answer queries of the form x / y = ? This is a perfect problem to learn how to model relationships as a weighted graph. What you will learn: β’ How to build a graph where each variable is a node and each equation is a weighted edge β’ Why this is basically a path search with product of weights β’ How to use DFS or BFS to answer each query β’ How to handle unknown variables and disconnected components β’ Full C++ implementation, step by step β’ Time and space complexity analysis π Problem link: https://leetcode.com/problems/evaluate-division/ π Watch the full LeetCode 75 playlist (C++ explanations + animations): https://www.youtube.com/playlist?list=PLF0G-7pZcOza_jyAxwMpa5KnK3vST5smK βββββ β± Timestamps (adjust after editing) 00:00 Intro & problem statement 01:00 Turning equations into a graph 04:00 DFS/BFS idea β path product = division result 08:00 Implementing the graph in C++ (adjacency list) 13:00 Answering queries with DFS/BFS 18:00 Handling unknown variables / no path case 20:00 Time and space complexity 21:00 Recap and next problems to try βββββ π» Technologies used β’ Language: C++ β’ Topic: Graphs, DFS, BFS, weighted graph β’ Difficulty: Medium β’ Use case: Interview prep, LeetCode practice βββββ If this helped you, consider: π Liking the video π Commenting which graph problem you want next β Subscribing for more C++ + algorithms explanations Follow LAN Academy Website: https://lanacademy-school.thinkific.com YouTube: @lanacademy9521 Twitter: https://x.com/SolutionsLan #leetcode #leetcode399 #cpp #graph #dfs #bfs #codinginterview
