Day 14 | LeetCode Learning Journal 🚀 Today I solved Binary Tree Zigzag Level Order Traversal (LeetCode 103). This problem helped me understand how to traverse a binary tree level by level while alternating the order of traversal at each level. 🔑 Key Points: • Uses Breadth-First Search (BFS) with a queue • Traverse the tree level by level • Alternate the traversal direction at each level (left → right, then right → left) • Store node values accordingly to achieve the zigzag pattern • Continue until all levels of the tree are processed 🌱 What I Learned: • How level order traversal works in binary trees • Implementing zigzag traversal using BFS • Managing traversal direction using a boolean flag • Improved understanding of queue-based tree traversal • Strengthened my binary tree problem-solving skills #LeetCode #100DaysOfCode #DSA #BinaryTree #BFS #ZigzagTraversal #Day14 🚀
Binary Tree Zigzag Level Order Traversal with BFS
More Relevant Posts
-
🚀 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 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
-
-
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 40 | LeetCode Learning Journal 🚀 Today I solved Validate Binary Search Tree (BST) using a range-based recursive approach. This problem helped me deeply understand how BST properties apply to the entire tree, not just immediate children! 🔑 Key Points: • Checked whether a binary tree is a valid BST. • Maintained a valid range (min, max) for each node. • Ensured every node follows BST rules globally. • Used recursion to traverse and validate nodes. 🌱 What I Learned: • Importance of passing constraints (min/max) in recursion. • Difference between local vs global validation in trees. • Strengthened understanding of Binary Search Tree properties. • Improved recursive thinking for tree problems. #LeetCode #100DaysOfCode #DSA #CodingJourney #Day40 🚀
To view or add a comment, sign in
-
-
24 of #100DaysOfCode 💻 Solved LeetCode 430 Flatten a Multilevel Doubly Linked List using recursion. 🔹 Key Learning: Recursion helps simplify complex hierarchical structures like multilevel linked lists by breaking them into smaller subproblems. 🔹 Approach: Traverse list node by node If child exists → recursively flatten Attach child list in between Maintain prev and next pointers carefully #DSA #Recursion #LinkedList #CodingJourney #LeetCode #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 44 – LeetCode practice update Today I solved: • Matrix Similarity After Cyclic Shifts Checked whether each row remains unchanged after k cyclic shifts without actually modifying the matrix. Used index manipulation: For left shift → compared using (j + k) % n For right shift → compared using (j - k + n) % n This helped verify similarity efficiently without performing actual shifts. Time Complexity: O(m × n) Good practice on handling cyclic shifts using index-based logic instead of brute-force operations. #LeetCode #DSA #Matrix #Arrays #ProblemSolving #CodingPractice #Consistency
To view or add a comment, sign in
-
-
Day 37 : Practicing Backtracking on LeetCode 💡 Today’s live practical session in Alpha Plus 7.0 was all about execution. We took the theory of Backtracking and applied it directly to solve problems on LeetCode. Today’s Checklist: ✅ Backtracking Execution: Reinforced the core logic of exploring all possible combinations and retreating when necessary. ✅ Phone Keypad Problem: Successfully solved the classic "Letter Combinations of a Phone Number" problem on LeetCode. ✅ Mapping Logic: Mastered how to map numeric digits to character arrays and recursively generate every single valid string combination. #Backtracking #LeetCode #DSA #Algorithms #SoftwareEngineering #100DaysOfCode #ApnaCollege
To view or add a comment, sign in
-
-
🚀 Day 11/100 — LeetCode Challenge Today's problem: Daily Temperatures 🧠 Concept: Monotonic Stack 💡 Key Idea: Use a stack to store indices of temperatures. When a higher temperature is found, resolve previous indices to calculate the number of days required. ⚡ Time Complexity: O(n) 📂 Solutions Repository https://lnkd.in/gkFh2mPZ Learning how monotonic stack helps solve “next greater element” type problems efficiently. #100DaysOfLeetCode #DSA #LeetCode #CodingChallenge #SoftwareEngineering
To view or add a comment, sign in
-
🚀 Day 20 | LeetCode Learning Journal. Today I solved Minimum Depth of Binary Tree. This problem looked simple at first, but it taught me an important edge case in binary trees! 🔑 Key Points: • Used recursion (DFS) to calculate depth. • Handled cases where one subtree is missing. • Learned that we must not take min of NULL paths directly. • Carefully checked leaf nodes (both left & right NULL). • Returned correct depth by considering valid paths only. 🌱 What I Learned: • Difference between minimum depth and general depth calculation • Importance of handling edge cases in trees • How NULL nodes can affect recursion results • Improved understanding of binary tree traversal logic #LeetCode #100DaysOfCode #DSA #BinaryTree #Recursion #DFS #Day20 🚀
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
👏 👏