Day 79 | #100DaysOfCode | #100DaysOfLearning 🧿 Still diving deeper into the Binary Tree pattern ✅ Solved: Symmetric Tree (Leetcode 101) This problem checks whether a binary tree is a mirror of itself around its center. 💡 Key Idea: Instead of comparing nodes in the same direction, we compare them crosswise: Left subtree of node A ↔ Right subtree of node B Right subtree of node A ↔ Left subtree of node B If both sides match at every level → the tree is symmetric. Approach (Recursion): If both nodes are NULL → symmetric If one is NULL → not symmetric Values must match Recursively compare: left.left with right.right left.right with right.left 📌 This problem strengthened my understanding of: ✔️ Mirror recursion in trees ✔️ Comparing two structures simultaneously ✔️ Thinking about trees from two directions at once Consistency continues… 79 days of showing up and learning something new. #100DaysOfCode #DSA #BinaryTree #Leetcode #CodingJourney #ProblemSolving #SoftwareEngineering #TechCommunity #Programmers #Developers #LearnInPublic
Symmetric Tree Problem Solved with Binary Tree Pattern
More Relevant Posts
-
🚀 Day 33 | 100 Days of Coding Challenge #DrGViswanathanChallenge 📘 Problem Solved: Valid Parentheses (LeetCode) 🔧 Approach Used (Stack): • Traversed the string character by character • Pushed all opening brackets onto the stack • For every closing bracket, checked the top of the stack • Ensured correct matching and order 📌 Key Idea: Last opened bracket should be the first to close → perfect use of LIFO (Stack) ⏳ Complexity: Time: O(n) Space: O(n) 🧠 Key Learning: Stacks are ideal for problems involving balanced expressions and order validation. 📂 Topics Covered: Stack, Strings, Expression Validation #100DaysOfCode #DSA #CPP #LeetCode #CodingJourney #CompetitiveProgramming
To view or add a comment, sign in
-
-
🚀 Day 2 of 100 Days LeetCode Challenge Problem: Minimum Swaps to Arrange a Binary Grid Today’s problem was a great mix of greedy thinking + pattern observation. 💡 Problem Insight: We need to make the grid valid such that all elements above the main diagonal are 0. The only allowed operation is swapping adjacent rows. 🔍 Core Idea: Count trailing zeros in each row For each row i, we need at least (n - i - 1) zeros at the end If a row doesn’t satisfy, find a row below that does Bring it up using swaps (like bubble sort) 👉 If no such row exists → return -1 🔥 What I Learned Today: o Greedy approach can minimize operations efficiently o Thinking in terms of requirements per position simplifies the problem o Sometimes problems are just rearrangement with constraints 📈 Challenge Progress: Day 2/100 ✅ Staying consistent! LeetCode, Greedy Algorithm, Arrays, Matrix, Coding Challenge, Problem Solving, DSA Practice, Algorithm Thinking, Optimization, Programming #100DaysOfCode #LeetCode #DSA #CodingChallenge #GreedyAlgorithm #ProblemSolving #TechJourney #ProgrammerLife #SoftwareDeveloper #CodingLife #LearnToCode #Developers #Consistency #GrowthMindset #InterviewPrep
To view or add a comment, sign in
-
-
🚀 Day 49/100 — Simplicity Wins Again 💯. Today’s problem: LeetCode 2529 — Maximum Count of Positive and Negative Integers. 📌 Problem Summary: Given a sorted array, 👉 Count positive numbers 👉 Count negative numbers 👉 Return the maximum of both ⚠️ Ignore zeros 💡 Brute Force: a)Traversed the array once. b)Counted positives and negatives separately. c)Returned max(positive, negative). 🧠 Key Learning: 👉 Simple counting problems can be solved in one pass. 👉 Edge cases like 0 matter a lot. 👉 Clean and readable code > complex logic. ⚡ Insight: Not every problem needs optimization — clarity and correctness come first 👀 🎯 Showing up daily > being perfect 🚀 #LeetCode #DSA #CodingJourney #KeepLearning
To view or add a comment, sign in
-
-
🚀 Day 3/100 — LeetCode Challenge Continuing my 100 Days of LeetCode journey to improve problem-solving skills. Today's problem: Product of Array Except Self 🧠 Concept: Prefix and Suffix Products 💡 Key Idea: Instead of recalculating the product for each element, we compute prefix and suffix products and combine them to achieve an efficient O(n) solution without using division. ⚡ Time Complexity: O(n) 📂 Solutions Repository https://lnkd.in/gkFh2mPZ Every problem is teaching me new ways to think about optimization and patterns. #100DaysOfLeetCode #DSA #LeetCode #CodingChallenge #SoftwareEngineering
To view or add a comment, sign in
-
🚀 Day 6 of 100 Days LeetCode Challenge Problem: Check if Binary String Has at Most One Segment of Ones Today’s problem is all about pattern observation in strings—simple, but easy to overthink. 💡 Key Insight: The string should contain only one continuous block of '1's. 👉 That means: Once a 0 appears after a 1, There should be no more '1's later 🔍 Simplest Trick: Just check if the pattern "01" appears more than once OR even better → check if "10" appears followed by another "1" 💡 Cleaner approach: Traverse the string Count transitions from 1 → 0 If you ever see 1 again after that → ❌ Invalid 🔥 What I Learned Today: Many problems are just pattern validation Clean logic beats complex conditions Always try to reduce the problem to a simple rule 📈 Challenge Progress: Day 6/100 ✅ Consistency building strong! LeetCode, Strings, Pattern Recognition, Greedy, DSA Practice, Coding Challenge, Problem Solving, Algorithm Thinking, Programming #100DaysOfCode #LeetCode #DSA #CodingChallenge #Strings #ProblemSolving #TechJourney #ProgrammerLife #SoftwareDeveloper #CodingLife #LearnToCode #Developers #Consistency #GrowthMindset #InterviewPrep
To view or add a comment, sign in
-
-
Day 46 on LeetCode — Bag of Tokens 💰✅ Today’s problem was a great mix of greedy strategy and two-pointer optimization. 🔹 Approach Used in My Solution The goal was to maximize the score by strategically playing tokens either face up (lose power, gain score) or face down (gain power, lose score). Key idea in the solution: • Sort the tokens to process smallest and largest efficiently • Use two pointers — start (smallest token) and end (largest token) • If enough power → play smallest token face up to gain score • If low on power but have score → play largest token face down to regain power • Track the maximum score achieved during the process This greedy approach ensures optimal decisions at every step. ⚡ Complexity: • Time Complexity: O(n log n) (due to sorting) • Space Complexity: O(1) 💡 Key Takeaways: • Learned how greedy decisions can maximize outcomes step by step • Practiced combining two pointers with strategic decision making • Reinforced thinking in terms of trade-offs (power vs score) #LeetCode #DSA #Algorithms #DataStructures #GreedyAlgorithm #TwoPointers #ProblemSolving #Coding #Programming #Cpp #STL #SoftwareEngineering #ComputerScience #CodingPractice #DeveloperLife #TechJourney #CodingDaily #100DaysOfCode #BuildInPublic #AlgorithmPractice #CodingSkills #Developers #TechCommunity #SoftwareDeveloper #EngineeringJourney
To view or add a comment, sign in
-
-
Day 45 of solving LeetCode problems. Solved: Defuse the Bomb This problem looks simple, but it tests a key concept — handling circular arrays with a sliding window. Instead of recalculating sums repeatedly (O(n*k)), I used a rolling window to bring it down to O(n). The tricky part was managing indices correctly when moving forward vs backward (k > 0 vs k < 0). Key takeaway: Efficient thinking is about avoiding redundant work, not just getting the correct answer. Consistency is good, but improving how you think matters more. #leetcode #dsa #problemSolving #coding #100DaysOfCode
To view or add a comment, sign in
-
-
Today I worked on leetcode problem no. 1415 The k-th Lexicographical Happy String of Length n.” First, let's understand the concept. A happy string is a string that: Uses only the characters 'a', 'b', 'c' Does not allow two adjacent characters to be the same Concepts practiced: Backtracking Lexicographical ordering Recursion Start with an empty string Try adding 'a', 'b', 'c' Skip a character if it is the same as the previous one When the string length becomes n, we found one valid happy string Since we generate them in lexicographical order, the moment we reach the k-th string, that is our answer. #leetcode #leetcode1415 #dsa #datastructures #algorithms #backtracking #recursion #coding #programming #problemSolving #codingpractice #softwareengineering #developer #codinglife #computerscience #codingjourney #learncoding #codingcommunity #buildinpublic #100daysofcode #competitiveprogramming #cpp #techskills
To view or add a comment, sign in
-
-
Day 26 | LeetCode Learning Journal 🚀 Today I solved Permutations. This problem helped me understand the concept of recursion and backtracking more deeply! 🔑 Key Points: • Used backtracking to generate all possible arrangements. • Swapped elements to fix one position at a time. • Recursively solved for the remaining array. • Backtracked by swapping elements back to their original positions. • Explored all possible permutation paths systematically. 🌱 What I Learned: • Strong understanding of recursion tree and backtracking flow. • Importance of undoing changes (backtracking step). • How to generate all permutations efficiently. • Improved problem-solving approach for recursive problems. #LeetCode #100DaysOfCode #DSA #CodingJourney #Day26 🚀
To view or add a comment, sign in
-
-
Day 44 on LeetCode — Boats to Save People 🚤✅ Today’s challenge focused on applying the Two Pointer technique combined with sorting to optimize resource allocation. 🔹 Approach Used in My Solution The goal was to determine the minimum number of boats required to rescue people, where each boat can carry at most two people without exceeding the weight limit. Key idea in the solution: • Sort the array of people by weight • Use two pointers — one at the lightest person (start) and one at the heaviest (end) • If the sum of their weights is within the limit, they share a boat • Otherwise, the heaviest person goes alone • Move pointers accordingly and increment the boat count This greedy strategy ensures we pair the heaviest person with the lightest possible partner, minimizing the total number of boats. ⚡ Complexity: • Time Complexity: O(n log n) (due to sorting) • Space Complexity: O(1) 💡 Key Takeaways: • Strengthened understanding of greedy algorithms • Practiced the two-pointer technique after sorting • Learned how pairing strategies can optimize resource usage #LeetCode #DSA #Algorithms #DataStructures #Arrays #TwoPointers #GreedyAlgorithm #ProblemSolving #Coding #Programming #Cpp #STL #SoftwareEngineering #ComputerScience #CodingPractice #DeveloperLife #TechJourney #CodingDaily #100DaysOfCode #BuildInPublic #AlgorithmPractice #CodingSkills #Developers #TechCommunity #SoftwareDeveloper #EngineeringJourney
To view or add a comment, sign in
-
Explore related topics
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