Day 11 | LeetCode Learning Journal 🚀 Today I practiced Binary Tree Postorder Traversal (Problem 145) on LeetCode. This traversal visits the root after processing both subtrees, which makes it useful for problems like deleting trees or evaluating expressions. 🔑 Key Points: • Traversal order: Left → Right → Root • Traverse the left subtree first • Then traverse the right subtree • Visit the root node at the end • Can be implemented using recursion or stacks 🌱 What I Learned: • How postorder traversal processes children before the parent • Why this traversal is useful in tree deletion and evaluation problems • Differences between preorder, inorder, and postorder traversals • Strengthened understanding of recursive tree algorithms • Built a stronger foundation for advanced tree problems #LeetCode #100DaysOfCode #DSA #BinaryTree #PostorderTraversal #Day11
Ayushi kumari’s Post
More Relevant Posts
-
Day 23 | LeetCode Learning Journal 🚀 Today I solved Binary Tree Tilt.This problem helped me understand how to combine tree traversal with calculations at each node! 🔑 Key Points: • Used postorder traversal to calculate subtree sums. • Calculated tilt as the absolute difference of left and right subtree sums. • Accumulated tilt for every node in the tree. • Focused on returning subtree sums while updating the result. • Efficient single traversal solution. 🌱 What I Learned: • How to compute values while traversing a tree. • Importance of postorder traversal in such problems. • Better understanding of recursion with return values. • Improved handling of tree-based calculations. #LeetCode #100DaysOfCode #DSA #CodingJourney #BinaryTree #Day23 🚀
To view or add a comment, sign in
-
-
Day 17 | LeetCode Learning Journal 🚀 Today I solved Binary Tree Maximum Path Sum. This problem helped me understand how to find the maximum path sum in a binary tree, where a path can start and end at any node. 🔑 Key Points: • Uses Depth-First Search (DFS) with recursion. • Calculate the maximum contribution from left and right subtrees. • Ignore negative path sums to maximize the result. • Update the global maximum path sum at each node. • Continue traversal until all nodes are processed. 🌱 What I Learned: • How to handle complex recursion in binary trees • Calculating path sums while traversing the tree • Managing global variables to track the maximum result • Improved understanding of DFS in tree problems • Strengthened my problem-solving skills for advanced binary tree questions #LeetCode #100DaysOfCode #DSA #BinaryTree #DFS #MaximumPathSum #Day17 🚀
To view or add a comment, sign in
-
-
Day 13 | LeetCode Learning Journal 🚀 Today I solved Maximum Depth of Binary Tree on LeetCode. This problem helped me understand how to find the maximum depth (height) of a binary tree, which represents the longest path from the root node to a leaf node. 🔑 Key Points: • Uses Depth-First Search (DFS) with recursion • Recursively explore the left and right subtrees • The depth of a tree is calculated as 1 + max(left depth, right depth) • Base case: if the node is null, return 0 • Continue the process until all nodes are visited 🌱 What I Learned: • How recursion works in tree problems • Understanding the concept of height or depth of a binary tree • Practical use of DFS traversal • Improved problem-solving skills in binary tree structures • Strengthened my understanding of recursive algorithms #LeetCode #100DaysOfCode #DSA #BinaryTree #DFS #TreeDepth #Day13 🚀
To view or add a comment, sign in
-
-
🚀 Day 19/100 — LeetCode Challenge (Revision Day) Today I revised Monotonic Stack problems: • Daily Temperatures • Next Greater Element I 🧠 Key Learning: Monotonic stack is extremely useful for solving “next greater/smaller element” problems efficiently in O(n) time. Revisiting these problems helped strengthen pattern recognition and understanding. 📂 Solutions Repository https://lnkd.in/gkFh2mPZ #100DaysOfLeetCode #DSA #LeetCode #CodingChallenge #Revision
To view or add a comment, sign in
-
🚀 Day 23/100 – LeetCode Challenge ✅ Problem Solved: Sort an Array Today’s problem was all about implementing sorting from scratch without using any built-in functions. I used the Merge Sort algorithm to achieve the required O(n log n) time complexity. This was a great revision of divide-and-conquer concepts, where the array is recursively divided and then merged in sorted order. 💡 Key Learning: Understanding sorting algorithms is fundamental for interviews Merge Sort guarantees O(n log n) performance Writing algorithms from scratch improves problem-solving depth ⚡ Complexity: Time: O(n log n) Space: O(n) Building strong fundamentals, one day at a time 🚀 #Day23 #100DaysOfCode #LeetCode #DSA #Cpp #CodingJourney #Sorting #MergeSort
To view or add a comment, sign in
-
-
Day 34 | LeetCode Learning Journal 🚀 Today’s focus was Problem 104: Maximum Depth of Binary Tree. The core idea here is the elegance of Recursion. Instead of thinking about the entire tree at once, the concept is to break it down: the height of any node is simply 1 + the maximum height of its children. It’s fascinating how the code "drills down" to the leaf nodes (the base case) and then builds the answer back up as the recursion unwinds. This problem is a perfect example of how a Bottom-Up approach works—solving the smallest sub-problems first to find the solution for the root. 34 days done — and my intuition for recursive thinking is getting much sharper. Understanding how memory stacks and base cases interact is key to mastering more complex tree and graph algorithms. #LeetCode #100DaysOfCode #Recursion #BinaryTree #LogicBuilding #DSA #CPlusPlus #CodingJourney #ProblemSolving #DepthFirstSearch
To view or add a comment, sign in
-
-
🧩 LeetCode Challenge – Day 74 ✅ Today’s problem was a quick mathematical check involving powers. 🔗 LeetCode 326 – Power of Three The task is to determine whether a number can be expressed as a power of three. The straightforward idea is to repeatedly divide by 3 and verify that the remainder is always zero until reaching 1. 💡 Key Takeaways: • Repeated division is a simple way to verify power relationships • Edge cases like non-positive numbers must be handled carefully • Even small math problems help reinforce number intuition #Day74 #LeetCodeChallenge #365DaysOfCode #DSA #CodingJourney #ProblemSolving #Math
To view or add a comment, sign in
-
-
Day 15 | LeetCode Learning Journal 🚀 Today I solved Same Tree (LeetCode 100). This problem helped me understand how to compare two binary trees and check whether they are structurally identical and have the same node values. 🔑 Key Points: • Uses Depth-First Search (DFS) with recursion • Compare corresponding nodes of both trees • Check if both nodes are NULL (trees match at that point) • If values differ or structure differs → trees are not identical • Continue recursively for left and right subtrees 🌱 What I Learned: • How recursion works with binary trees • Comparing two trees node by node • Handling base cases in recursive tree problems • Strengthened my understanding of DFS in trees • Improved logical thinking for tree comparison problems #LeetCode #100DaysOfCode #DSA #BinaryTree #DFS #SameTree #Day15 🚀
To view or add a comment, sign in
-
-
🚀 Day 7/100 — LeetCode Challenge Solved Search in Rotated Sorted Array II At first, it feels similar to the previous rotated array problem, but duplicates make it harder to decide which half is sorted. 💡 Key idea: 1) Normally, one half is always sorted 2) But with duplicates, we can get stuck when low == mid == high 3) In that case, we shrink the search space from both ends 4) Otherwise, identify the sorted half and proceed like binary search 👉 Small change, but big impact on logic. 🧠 Time Complexity: Average: O(log n) Worst case: O(n) (due to duplicates) 💾 Space Complexity: O(1) Learning that small edge cases can completely change how an algorithm behaves. Staying consistent. #LeetCode #DSA #100DaysOfCode #Cpp #BinarySearch #CodingJourney
To view or add a comment, sign in
-
-
Day 16 | LeetCode Learning Journal 🚀 Today I solved Binary Tree Right Side View . This problem helped me understand how to identify the nodes visible when looking at a binary tree from the right side. 🔑 Key Points: • Uses Breadth-First Search (BFS) with a queue. • Traverse the binary tree level by level. • At each level, capture the last node visited. • The last node of every level represents the right side view. • Continue until all levels of the tree are processed. 🌱 What I Learned: • How to apply level order traversal in binary trees • Identifying the rightmost node at each level • Better understanding of queue-based traversal • Strengthened my binary tree traversal concepts • Improved problem-solving skills in tree-based problems #LeetCode #100DaysOfCode #DSA #BinaryTree #BFS #RightSideView #Day16 🚀
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development