✅ Day 10 of 100 Days LeetCode Challenge Problem: 🔹 #1448 – Count Good Nodes in Binary Tree 🔗 https://lnkd.in/gDfr48AK Concepts Used: 🔹 Binary Tree 🔹 Depth-First Search (DFS) 🔹 Recursion 🔹 Path-based State Tracking Approach Summary: 🔹 Used DFS to traverse the tree from root to leaves. 🔹 Maintained the maximum value (maxi) seen so far along the path. 🔹 A node is considered good if its value is greater than or equal to maxi. 🔹 Updated maxi at each step and accumulated the count recursively. Key Insight: 🔹 “Good nodes” depend on the path from the root, not the entire tree. 🔹 Passing state (maximum so far) through recursion avoids extra storage. 🔹 This leads to a clean and efficient solution with optimal traversal. #LeetCode #100DaysOfLeetCode #Day10 #DSA #Daily #Programming #ProblemSolving #Python #CodingJourney #TechCareers
Day 10 of 100 Days LeetCode Challenge: Count Good Nodes in Binary Tree
More Relevant Posts
-
🚀 𝟲𝟬 𝗗𝗮𝘆𝘀 𝗼𝗳 𝗖𝗼𝗱𝗶𝗻𝗴 | 𝗗𝗦𝗔 𝘅 𝗥𝗲𝗮𝗹 𝗪𝗼𝗿𝗹𝗱 𝗣𝗿𝗼𝗷𝗲𝗰𝘁𝘀 #Day50 | 𝗣𝗲𝗿𝗳𝗼𝗿𝗺𝗮𝗻𝗰𝗲 𝗔𝗻𝗮𝗹𝘆𝘇𝗲𝗿 𝗗𝗮𝘀𝗵𝗯𝗼𝗮𝗿𝗱 Built a Performance Analyzer Dashboard to compare Memoization vs Tabulation in Dynamic Programming using real execution-time measurements. Focused on: • Top-Down vs Bottom-Up DP • Time and space trade-offs • Performance comparison • Understanding when to choose the right DP strategy 📌 Code and documentation: https://lnkd.in/gxzGJ4nB Feedback and suggestions are welcome. #DSA #DynamicProgramming #Memoization #Tabulation #Python #60DaysOfCoding #LearningInPublic #SoftwareEngineering
To view or add a comment, sign in
-
LeetCode Problem 64: "Minimum Path Sum": Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path. Note: You can only move either down or right at any point in time. This problem clearly checks your understanding of dynamic programming. The below implementation in Python clearly and efficiently resolves this task in Time Complexity of O(m*n) and with constant space. The solution below modifies existing grid in-place, simply and clearly. #DSA #LeetCode #Python #Matrix #ComprtitiveProgramming #Algorithms #DataStructures #InterviewPrep #OptimalSolution #Programming
To view or add a comment, sign in
-
-
🚀 𝟲𝟬 𝗗𝗮𝘆𝘀 𝗼𝗳 𝗖𝗼𝗱𝗶𝗻𝗴 | 𝗗𝗦𝗔 𝘅 𝗥𝗲𝗮𝗹 𝗪𝗼𝗿𝗹𝗱 𝗣𝗿𝗼𝗷𝗲𝗰𝘁𝘀 #Day41 | 𝗕𝘂𝗱𝗴𝗲𝘁 𝗢𝗽𝘁𝗶𝗺𝗶𝘇𝗮𝘁𝗶𝗼𝗻 𝗧𝗼𝗼𝗹 Built a Budget Optimization Tool using Dynamic Programming (1D) to maximize value under budget constraints. Focused on: • 0/1 Knapsack pattern • State-based optimization • Space-efficient DP • Understanding how real-world budget decisions are optimized 📌 𝗖𝗼𝗱𝗲 𝗮𝗻𝗱 𝗱𝗼𝗰𝘂𝗺𝗲𝗻𝘁𝗮𝘁𝗶𝗼𝗻: https://lnkd.in/gxzGJ4nB Feedback and suggestions are welcome. #DSA #DynamicProgramming #Optimization #Knapsack #Python #60DaysOfCoding #LearningInPublic #SoftwareEngineering
To view or add a comment, sign in
-
Reproducibility shouldn't be this hard. "Same data, same code, same results" is the goal. However, between research and production, something always goes wrong. The packaging and environment management ecosystem is complex and constantly evolving. It affects everyone from solo researchers to large teams. We work with organizations to navigate these challenges, drawing on our involvement in conda, conda-forge, and Python packaging standards. The goal isn't just solving problems for one team, it's contributing to solutions that help the whole community move forward. What's your biggest packaging challenge? Learn more: https://lnkd.in/drrUQ-K2 #OpenSource #Python #DataScience
To view or add a comment, sign in
-
✅ Problem: Single Number (LeetCode #136) 🧠 Concept Used: Bit Manipulation (XOR) ⚡ Approach: XOR of two same numbers = 0 XOR with 0 = number itself Result: the unique element survives ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(1) This problem reinforced how powerful bitwise operations can be for writing clean and optimal code. Consistency > Motivation. Day 4 done. On to Day 5 💪 #100DaysOfCode #LeetCode #DSA #ProblemSolving #Python #CodingJourney #Consistency
To view or add a comment, sign in
-
-
✓ Week 4 Complete From scripts to software. This week was about structure - modules, packages, virtual environments. The stuff that turns messy code into something reusable. Built llm-test-utils - a Python package that bundles everything from the past 4 weeks: → Prompt formatters (Week 1) → Test data organizers (Week 2) → Response validators (Week 3) → All wrapped in a clean package structure (Week 4) Phase 0 (Python Foundation) Still stacking bricks. Code's in the repo - link in comments. #GenAITesting #LearnInPublic #LLMTesting #Python #AITesting #QAEngineer #LearningInPublic #GenAI #SoftwareTesting #52WeekChallenge
To view or add a comment, sign in
-
Python threads aren't what you think they are. 🤯 I was optimizing a CPU-bound task, expecting threads to speed things up. Instead, performance tanked. What was the deal? Python's Global Interpreter Lock (GIL) allows only one thread to execute Python bytecode at a time. For CPU-bound tasks, threading won't help. Use multiprocessing instead! 🧵🚫. Threads are great for I/O-bound tasks, though. 📡💡 💡 Key Takeaway: Use threading for I/O-bound tasks and multiprocessing for CPU-bound tasks to bypass the GIL. 🐍 Have you been bitten by the GIL? Share your story! 👇 #Django #Python #PythonProgramming #FastAPI #Coding #Programming
To view or add a comment, sign in
-
-
Day 55 of #Python108DaysChallenge 🐍 Learned the Floyd–Warshall Algorithm for computing all-pairs shortest paths using dynamic programming. Key insights: ✔ Works on dense weighted graphs ✔ Handles negative weights (no negative cycles) ✔ Complexity O(V³) ✔ Useful for routing tables and path analysis Another powerful addition to the graph algorithms toolkit! #Python #DSA #Graphs #FloydWarshall #DynamicProgramming #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
Tech Tips Friday! GeoBot 🤖 says, small Python habits create powerful results. Writing clean, readable code, following PEP 8 standards, and commenting your logic instead of the obvious make your programs easier to understand, maintain, and scale. These simple practices improve collaboration, reduce errors, and help your code age gracefully, turning everyday Python scripts into professional, high-quality solutions. #TechTipsFriday #PythonTips #PythonProgramming #SoftwareDevelopment #ProgrammingTips #ProgrammingFacts #Geotech
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