In this video, we solve LeetCode 1339. Maximum Product of Splitted Binary Tree using a clear intuition-driven DFS approach. The key idea is to realize that: 👉 removing one edge splits the tree into two subtrees, and 👉 the product depends only on the sum of one subtree and the remaining sum. So instead of trying all splits explicitly, we: 1️⃣ Compute the total sum of the tree 2️⃣ Run another DFS to compute every subtree sum 3️⃣ At each split, calculate subtreeSum × (totalSum − subtreeSum) and keep the maximum This transforms the problem into a simple two-pass DFS solution. This problem is part of today’s LeetCode Daily Problem of the Day (POTD). 🔹 What you’ll learn: • Why total tree sum is the key insight • How each edge represents a valid split • How DFS helps evaluate all possibilities 🔹 Topics: • Binary Tree • Depth-First Search (DFS) • Subtree Sum Clear problem explanation, intuition-first walkthrough, and clean Java implementation. Problem link - https://leetcode.com/problems/maximum... Java Code - https://pastebin.com/ij9TNyhN Python Code - https://pastebin.com/2J6rn2n1 Time complexity - O(N) Space Complexity - O(N) Page Marker Extension - https://chromewebstore.google.com/det... Video Chapters - 00:00 - Problem Statement 02:04 - Approach 07:28 - Code 12:05 - Time and Space Complexity Leetcode daily playlist - • LeetCode Daily Problems LeetCode Easy POTD playlist - • LeetCode Easy LeetCode Medium POTD playlist - • LeetCode Medium LeetCode Hard POTD playlist - • LeetCode Hard If you want to practice daily and improve your problem-solving skills, this is the place to follow along. #leetcode #dsa #tree #dfs #binarytree #leetcodeproblemoftheday #algorithm #java #python #code #leetcodechallenge #codinginterview #problemsolving