🚀 Day 40 of #100DaysOfDSA (Java) Today was focused on practicing Graph concepts. I attended a live session with my mentor where I: 🔹 Solved graph-based problems using BFS & DFS 🔹 Practiced traversal and path-related questions 🔹 Improved my understanding of graph problem-solving strategies Key takeaway: Graphs require strong conceptual clarity, and solving problems with guidance helps in building the right approach. Practicing BFS and DFS is helping me understand how to explore nodes efficiently and solve connectivity problems. Day 40 ✅ Focused on practice, consistency, and improving problem-solving skills. #DSA #Java #Graphs #BFS #DFS #ProblemSolving #100DaysOfCode #DeveloperJourney #LearningInPublic #Consistency
Java Graph Practice with BFS DFS
More Relevant Posts
-
Day 78/100 | #100DaysOfDSA 🧩🚀 Today’s problem: Maximum Level Sum of a Binary Tree A classic BFS (level-order traversal) problem on trees. Problem idea: Find the level of the tree that has the maximum sum of node values. Key idea: Level-order traversal using a queue. Why? • We need to process nodes level by level • BFS naturally groups nodes by levels • Easy to compute sum for each level How it works: • Use a queue to perform BFS • For each level: → Process all nodes in current queue size → Calculate the sum of that level • Track the maximum sum and corresponding level • Return the smallest level with maximum sum Time Complexity: O(n) Space Complexity: O(n) Big takeaway: Whenever a problem involves level-wise processing in trees, BFS is the go-to approach. 🔥 Day 78 done. 🚀 #100DaysOfCode #LeetCode #DSA #Algorithms #BinaryTree #BFS #LevelOrder #Java #CodingJourney #ProblemSolving #InterviewPrep #TechCommunity
To view or add a comment, sign in
-
-
🚀 Day 38/50 – #50DaysOfCode Today, I learned about ArrayList operations — concatenation, slicing, converting between arrays and ArrayLists, and the comparison between Array and ArrayList. Understanding these differences helps in choosing the right data structure effectively. ☕💻 #Day38 #JavaFullStack #Java #CCBP #NxtWave #LearningJourney #Consistency
To view or add a comment, sign in
-
🚀 Day 35/50 – #50DaysOfCode Today, I learned about array concatenation, array slicing, and multidimensional arrays in Java, along with how to iterate over multidimensional arrays. These concepts help in handling complex data structures more efficiently. ☕💻 #Day35 #JavaFullStack #Java #CCBP #NxtWave #LearningJourney #Consistency
To view or add a comment, sign in
-
🚀Day 40 LeetCode 1161 – Maximum Level Sum of a Binary Tree Ever wondered how to find the level of a binary tree with the maximum sum of node values? 🤔 Here’s the idea: We traverse the tree level by level (BFS) and compute the sum at each level. The trick is to keep track of the maximum sum and return the smallest level where this occurs. 💡 Key Insight: Level-order traversal (using a queue) naturally processes nodes one level at a time, making it perfect for this problem. 🔧 Approach: ✔ Use a queue for BFS ✔ For each level: • Calculate sum of nodes ✔ Track maximum sum and corresponding level 🔥 Takeaway: Whenever a problem involves levels in a tree, think BFS first — it often leads to the cleanest solution. #LeetCode #DataStructures #Java #CodingInterview #BinaryTree #BFS #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 60 of #100DaysOfCode Solved 100. Same Tree on LeetCode 🔗 🧠 Key Insight: Two trees are the same if: 👉 Their structure is identical 👉 Corresponding nodes have equal values ⚙️ Approach (Recursive DFS): 1️⃣ If both nodes are null → ✅ return true 2️⃣ If one is null and other is not → ❌ return false 3️⃣ If values are different → ❌ return false 4️⃣ Recursively check: 🔹 Left subtree → isSame(p.left, q.left) 🔹 Right subtree → isSame(p.right, q.right) 5️⃣ Return: 👉 leftCheck && rightCheck ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(h) (recursive stack) #100DaysOfCode #LeetCode #DSA #BinaryTree #Recursion #DFS #Java #InterviewPrep #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 70 of #100DaysOfCode Solved 107. Binary Tree Level Order Traversal II on LeetCode 🔗 🧠 Key Insight: This is just level order traversal (BFS) but: 👉 Return levels from bottom to top instead of top to bottom ⚙️ Approach (DFS with Level Tracking): 1️⃣ Start traversal with level = 0 2️⃣ For each node: 🔹 If level not present → insert new list at front 🔹 Add value at correct position: 👉 res.get(res.size() - 1 - level) 3️⃣ Recurse: 🔹 Left → level + 1 🔹 Right → level + 1 ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(n) #100DaysOfCode #LeetCode #DSA #BinaryTree #BFS #DFS #Java #InterviewPrep #CodingJourney
To view or add a comment, sign in
-
-
Day 86 – Binary Tree Level Order Traversal Worked on traversing a binary tree level by level using a queue-based approach (Breadth-First Search). Key Learnings: Learned to use a queue (FIFO) for level-wise traversal of trees Understood how to process nodes layer by layer using queue size Strengthened understanding of tree traversal patterns and data structure usage #DSA #Java #BinaryTree #BFS #Queue #ProblemSolving #CodingPractice
To view or add a comment, sign in
-
-
Day 84 - Binary Tree Right Side View Computed the visible nodes when viewing a binary tree from the right side. Approach: • Use level order traversal (BFS) • Process nodes level by level • Add the last node of each level to the result Key Idea: The rightmost node at each level is the visible one Time Complexity: O(n) Space Complexity: O(n) #Day84 #LeetCode #BinaryTree #BFS #DSA #Java #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 25 of #100DaysOfDSA (Java) Today I explored Queue, an important linear data structure that follows the FIFO (First In First Out) principle. Covered: 🔹 Introduction to Queue 🔹 Queue implementation using arrays and Linked List 🔹 Queue operations (enqueue, dequeue, peek) 🔹 Circular Queue concept 🔹 Understanding difference between Stack and Queue Key takeaway: Unlike stacks, queues process elements in order, making them useful for scheduling, buffering, and real-world scenarios like task management systems. Also learned how queues are widely used in algorithms like Breadth-First Search (BFS). Day 25 ✅ Expanding understanding of core data structures. #DSA #Java #Queue #DataStructures #100DaysOfCode #ProblemSolving #DeveloperJourney #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Solved Binary Tree Level Order Traversal on LeetCode Today I practiced another important Binary Tree problem using Queue + BFS Traversal in Java. 🌳 🔹 Level Order Traversal Order: Node by Node, Level by Level 🔹 Approach Used: • Used Queue data structure • Inserted root node first • Processed one level at a time • Stored each level in separate list • Added left and right child nodes step by step 📊 Result: ✔️ All test cases passed (35/35) ✔️ Runtime: 1 ms ✔️ Beats 95.37% submissions 💡 Key Learning: DFS helps in depth traversal, but Queue + BFS is perfect when we need level wise output. Understanding when to use Stack, Recursion, or Queue is what makes problem solving stronger. 🔥 Currently improving Trees, Graphs, Binary Search, HashMap patterns, and DP step by step. #DSA #Java #LeetCode #BinaryTree #BFS #Queue #ProblemSolving #CodingJourney #Placements
To view or add a comment, sign in
-
Explore related topics
- Build Problem-Solving Skills With Daily Coding
- Tips for Problem-Solving with Clarity
- How Graph-Based Approaches Improve Data Management
- Strategies for Data-Driven Problem Solving
- How to Develop Structured Problem Solving Skills
- Problem-Solving Mentoring
- Data Science Skills for Versatile Problem Solving
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