17 of #100DaysOfCode 💻🔥 Today I solved Add Two Numbers (Linked List) — one of the most classic and fundamental Linked List problems on LeetCode. Instead of converting numbers directly, the challenge is to simulate addition digit by digit while handling carry properly — just like we do in real life math 🧮 💡 Key Learnings: ✔️ Importance of using a dummy node to simplify edge cases ✔️ Proper handling of carry across iterations ✔️ Traversing two linked lists simultaneously ✔️ Clean pointer manipulation avoids unnecessary bugs #100DaysOfCode #DSA #LinkedList #LeetCode #CodingJourney #ProblemSolving #CPlusPlus #TechGrowth
Solving Add Two Numbers in Linked Lists with C++
More Relevant Posts
-
Day 4 of My LeetCode Consistency Journey Today I solved LeetCode 151 – Reverse Words in a String (Medium). This problem focuses on: String manipulation Handling extra spaces Efficient traversal Edge case management 💡 Key Learning: Understanding how to properly parse words, remove leading/trailing spaces, and reconstruct the string efficiently improves logical thinking and strengthens DSA fundamentals. Instead of relying on built-in shortcuts, I focused on: ✔️ Clean logic ✔️ Optimized approach ✔️ Handling edge cases carefully Consistency > Motivation 💯 #LeetCode #DSA #ProblemSolving #CodingJourney #Cplusplus #100DaysOfCode #SoftwareEngineering #TechGrowth
To view or add a comment, sign in
-
Day 5 of My LeetCode Journey Today I solved LeetCode 150 – Evaluate Reverse Polish Notation (Medium). This problem strengthened my understanding of: Stack data structure Postfix expression evaluation Operator handling (+, -, *, /) Edge case management (negative numbers & division) 💡 Key Learning: Reverse Polish Notation removes the need for parentheses, but requires strong stack logic and careful operand order handling. This problem reinforced how powerful stacks are in expression evaluation and real-world compiler logic. Consistency is the real game changer. On to Day 5 🚀 #LeetCode #DSA #Stacks #ProblemSolving #Cplusplus #CodingJourney #SoftwareEngineering #100DaysOfCode
To view or add a comment, sign in
-
Day 8 / 100 Days of Code Challenge 💻🔥 Solved LeetCode 160 — Intersection of Two Linked Lists 🔗 🔍 Problem • Given two singly linked lists, find the node where they intersect • If no intersection exists, return null ⚙️ Approach (Two Pointer Switching) • Use two pointers starting at headA and headB • Traverse both lists simultaneously • When a pointer reaches the end, redirect it to the other list’s head 🔄 • Continue until both pointers meet • The meeting point is the intersection node (or null if no intersection) 💡 Key Learning • Equalizing path lengths without explicitly calculating them • Efficient pointer manipulation technique • Clean and optimal solution without extra space ⏱ Complexity • Time: O(n + m) ⏳ • Space: O(1) 📦 Consistency continues 🚀 #100DaysOfCode #LeetCode #DSA #LinkedList #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
Day 27 of my #50DaysOfCode challenge is done ✅ 📌 Problem Solved Convert Octal to Binary We were given an octal number. Task was to convert it into binary. Instead of converting directly, we used a two-step process. First → Octal to Decimal. Then → Decimal to Binary. 💻 Approach Step 1: Octal to Decimal 🔹️Take each digit of the octal number. 🔹️Multiply it with (8^i). 🔹️Increase power (i) as we move left. 🔹️Add all values to get decimal number. Step 2: Decimal to Binary 🔹️Divide the decimal number by 2 repeatedly. 🔹️Store the remainders. 🔹️Continue until the number becomes 0. 🔹️Read the remainders in reverse order. That gives the binary number. 📊 Complexity Analysis Time Complexity: O(log n) Space Complexity: O(1) Only a few variables are used. 📚 What I learned today: ▫️Number system conversions can be chained. ▫️Octal to decimal uses powers of 8. ▫️Binary conversion uses repeated division by 2. ▫️Breaking the problem into steps makes it easier. Day 27 completed. Practicing number system conversions 🚀 #50DaysOfCode #CodingChallenge #Consistency #LearningInPublic
To view or add a comment, sign in
-
18 of #100DaysOfCode Today I solved Rotate List (Problem 61) on LeetCode. At first glance, it looks like a simple linked list problem… But the real challenge? 👉 Handling large k values 👉 Understanding circular linking 👉 Breaking the list at the exact right position 💡 Key Learnings: ✔️ Always calculate k % length to avoid unnecessary rotations ✔️ Turning the list into a circular linked list simplifies logic ✔️ Edge cases (empty list / single node) matter a lot #DSA #LinkedList #CodingJourney #ProblemSolving #Cpp #TechGrowth #Consistency
To view or add a comment, sign in
-
-
🚀 Day 2/100 — LeetCode Challenge Continuing my 100 Days of LeetCode journey to strengthen my Data Structures and problem-solving skills. Today's problems: • Contains Duplicate • Valid Anagram 🧠 Concepts Used HashSet and HashMap for efficient lookups and frequency counting. 💡 Key Learning Hash-based data structures are extremely useful for reducing time complexity from O(n²) to O(n) in many array and string problems. 📂 Solutions Repository https://lnkd.in/gkFh2mPZ Day 2 complete. Excited to continue learning and improving every day. #100DaysOfLeetCode #DSA #LeetCode #CodingChallenge #SoftwareEngineering
To view or add a comment, sign in
-
Binary Search Mastery Complete Coverage for LeetCode & CodeForces Struggling with LeetCode Medium & Hard Binary Search problems? Or stuck in 800–1900 rated CodeForces questions? This 10-part structured series, covered by Prakash, includes every major Binary Search variation from fundamentals to advanced contest-level patterns. • Binary Search on Answer • Real numbers & precision handling • Prefix sums, rotated arrays, matrices • Greedy + DP + Two Pointers with BS • Ternary & Implicit Binary Search Complete coverage. Zero gaps. Built for serious contest improvement. Playlist Link: https://lnkd.in/gGh6ctSz Channel Link: https://lnkd.in/g6ydpTcS #codehurdle #codeforces #leetcode #cp #DSA
To view or add a comment, sign in
-
-
Day 65/100 – #100DaysOfLeetCode 🚀 🧩 Problem: LeetCode 204 – Count Primes (Medium) 🧠 Approach: Create a boolean array to mark prime numbers and iteratively mark multiples of each prime as non-prime. 💻 Solution: class Solution: def countPrimes(self, n: int) -> int: if n <= 2: return 0 isPrime = [True] * n isPrime[0] = isPrime[1] = False i = 2 while i * i < n: if isPrime[i]: for multiple in range(i * i, n, i): isPrime[multiple] = False i += 1 return sum(isPrime) ⏱ Time | Space: O(n log log n) | O(n) 📌 Key Takeaway: The Sieve of Eratosthenes efficiently finds all prime numbers up to n by eliminating multiples of each prime. #leetcode #dsa #development #problemSolving #CodingChallenge
To view or add a comment, sign in
-
-
🚀 LeetCode — Day 4 Solved: Combination Sum II Today was all about Backtracking + Smart Pruning. Approach: • Sort the array first • Use recursion to explore combinations • Skip duplicates carefully • Prune early if the current sum exceeds target The key learning wasn’t just recursion — it was understanding how to avoid duplicate combinations efficiently and when to stop exploring a path. Backtracking problems really test clarity of thought. One small mistake in conditions → completely wrong output. Step by step, improving recursion confidence and decision-making. Day 4 of consistency. Still building. 🔁🔥 #LeetCode #Day4 #DSA #Backtracking #ProblemSolving #CodingJourney #Consistency #Cpp
To view or add a comment, sign in
-
-
💧 Day 5/100 – LeetCode DSA Challenge Problem: Water Bottles (#1518) 🎯 Goal: Given "numBottles" and "numExchange", determine the maximum number of bottles you can drink if you can exchange empty bottles for full ones. 💡 Key Insights: • The process follows a simple cycle: drink → collect empty bottles → exchange → repeat. • A greedy approach works effectively for this problem. • Time Complexity: O(log₍numExchange₎(numBottles)) Every day is a step forward in improving problem-solving and DSA skills 🚀 #100DaysOfCode #LeetCode #DSA #CodingChallenge #ProblemSolving
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