Day 1 of #30DaysOfLeetCode Solved #2. Add Two Numbers on LeetCode using C. Approach: • Used Linked List traversal to process both numbers digit by digit • Added digits from both lists along with a carry value • Created new nodes dynamically to store each result digit • Handled cases where lists have different lengths • Continued the loop until both lists and carry were processed Performance: • Runtime: 0 ms (Beats 100% submissions) • Memory: 13.50 MB (Beats 8.30% submissions) Key Learning: • Strengthened understanding of Linked Lists and pointer manipulation • Learned how to manage carry during digit addition • Improved problem-solving skills with dynamic node creation Learning one problem every day 💻🔥 #30DaysOfCode #LeetCode #CProgramming #DSA #LinkedList #ProblemSolving
LeetCode Day 1: Add Two Numbers with Linked List Traversal in C
More Relevant Posts
-
🚀 Day 28/60 — LeetCode Discipline Problem Solved: Number of 1 Bits (Hamming Weight) Difficulty: Easy Today’s problem explored the fundamentals of bit manipulation, one of the most powerful and efficient areas in programming. The task was to count the number of set bits (1s) in the binary representation of a number. Instead of converting the number to a binary string, the solution uses bitwise operations to efficiently extract each bit. This approach highlights how low-level operations can lead to high-performance solutions with minimal overhead. 💡 Focus Areas: • Strengthened bit manipulation concepts • Practiced use of bitwise AND (&) • Understood right shift operations (>>>) • Improved efficiency by avoiding extra space • Built deeper understanding of binary representation ⚡ Performance Highlight: Achieved 0 ms runtime (100% performance). Mastering bits is like learning the language of machines — once you understand it, everything becomes faster and sharper. #LeetCode #60DaysOfCode #100DaysOfCode #DSA #BitManipulation #Algorithms #ProblemSolving #CodingJourney #SoftwareEngineering #Java #Developers #TechGrowth #Consistency #LearnToCode
To view or add a comment, sign in
-
-
🚀 LeetCode Problem Solved: Maximum Number of Vowels in a Substring of Given Length Today I solved LeetCode 1456 – Maximum Number of Vowels in a Substring of Given Length using the Sliding Window Technique. 🔹 Problem Statement: Given a string s and an integer k, find the maximum number of vowels in any substring of length k. 🔹 Approach: Instead of checking every substring separately, I used the Sliding Window algorithm: • Count vowels in the first window of size k • Slide the window forward one character at a time • Add the new character and remove the old one from the count • Track the maximum vowels seen so far This approach optimizes the solution to O(n) time complexity. 📌 Example: Input: s = "abciiidef", k = 3 Output: 3 Explanation: The substring "iii" contains 3 vowels, which is the maximum. 💡 Key Concepts Practiced: ✔ Sliding Window Technique ✔ String Traversal ✔ Efficient Problem Solving Consistent DSA practice on LeetCode is helping me improve my algorithmic thinking and coding efficiency. #LeetCode #DSA #SlidingWindow #ProblemSolving #CodingPractice #Java #LearningInPublic #Programming
To view or add a comment, sign in
-
-
💻 Implemented Binary Search in C today 🚀 Learned how dividing the search space reduces time complexity from O(n) to O(log n). Focused on clear logic and clean code using left, right, and mid. 📌 Simple logic → Efficient solution #BinarySearch #CProgramming #DSA #CodingJourney Github : https://lnkd.in/gtwwQWed
To view or add a comment, sign in
-
-
🚀 Day 25/30 of our DSA consistency challenge Today we worked on a classic Dynamic Programming problem on LeetCode. ✅ 300 – Longest Increasing Subsequence This problem helped us understand how building solutions by extending previous increasing sequences can lead to finding optimal answers efficiently. Learning and improving consistently with Suruthi Vijaya — discussing approaches together makes problem solving much clearer. 💻🔥 💡 DSA Tip: When a problem involves finding the longest / maximum subsequence or sequence, try thinking in terms of Dynamic Programming states. #Day25 #LeetCode #DSA #DynamicProgramming #ProblemSolving #CodingJourney #Consistency
To view or add a comment, sign in
-
-
🚀 Day 80 of #100DaysOfCode Today I solved the CamelCase problem 💻 📌 Problem: Given a string in CamelCase format, count how many words are present. 🧠 Key Insight: Every uppercase letter represents the start of a new word. So, total words = number of uppercase letters + 1 ✅ Example: saveChangesInTheEditor → 5 words ⚡ What I learned: String traversal in C Using isupper() effectively Writing clean and efficient logic 💡 Consistency is the real game-changer. Small problems daily = big growth over time. #Day80 #CodingJourney #100DaysOfCode #CProgramming #ProblemSolving #DeveloperLife #LearningEveryday
To view or add a comment, sign in
-
🧩 LeetCode Challenge – Day 75 ✅ Today’s problem was a classic Dynamic Programming challenge focused on transforming one string into another. 🔗 LeetCode 72 – Edit Distance The goal is to compute the minimum number of operations needed to convert one string into another using insertions, deletions, or replacements. Defining the DP state as the cost to convert prefixes of the two strings makes the transitions systematic. 💡 Key Takeaways: • String transformation problems often rely on well-defined DP states • Breaking the problem into prefix comparisons simplifies reasoning • Understanding base cases is crucial for correct DP initialization #Day75 #LeetCodeChallenge #365DaysOfCode #DSA #CodingJourney #ProblemSolving #DynamicProgramming #Strings
To view or add a comment, sign in
-
-
🚀 Day 135 – LeetCode 150 Days Challenge Today’s problem focused on the classic Coin Change Problem using Dynamic Programming (Top-Down / Memoization). 🧩 Problem Given an array of coin denominations and a target amount, find the minimum number of coins required to make that amount. If it is not possible, return -1. Example: Coins = [1,2,5], Amount = 11 Output → 3 (5 + 5 + 1) 💡 Key Idea This problem is similar to the Unbounded Knapsack pattern because we can use each coin multiple times. For each coin, we have two choices: 1️⃣ Not Take the coin → Move to the previous coin 2️⃣ Take the coin → Stay on the same coin index and reduce the amount We use recursion + memoization to store already computed states. State definition: dp[i][amount] Minimum coins required using coins from 0..i to make amount. ⚙️ Base Cases ✔ If amount == 0 → we need 0 coins ✔ If we are at the first coin (i == 0): If the amount is divisible by coins[0], return amount / coins[0] Otherwise return a large value (1e9) to represent impossible 🧠 Complexity ⏱ Time Complexity: O(N × Amount) 💾 Space Complexity: O(N × Amount) (DP table + recursion stack) 📌 What I Learned • How unbounded choices change DP transitions • The importance of handling impossible states using large values • How memoization reduces exponential recursion to polynomial time 🔥 Consistency > Motivation Day 135 completed, and the journey continues! #LeetCode #DSA #DynamicProgramming #CodingChallenge #150DaysOfCode #LeetCode150 #ProblemSolving
To view or add a comment, sign in
-
-
Day 18/50 — LeetCode First Bad Version taught me a key lesson: Linear search isn’t always enough Optimization matters for large inputs Binary Search reduces complexity from O(n) → O(log n) Learning to code smarter, not just harder. #Day18 #LeetCode #BinarySearch #DSA #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 94 of #100DaysOfCode Today I solved the "Funny String" problem on HackerRank using C 💻 🔍 Problem Insight: A string is called Funny if the absolute differences between adjacent characters are the same when compared with its reverse. 👉 Instead of actually reversing the string, I optimized the solution by comparing characters from both ends — saving space and improving efficiency. 💡 Key Learning: Efficient string traversal techniques Avoiding unnecessary space usage Writing optimized logic with O(n) time complexity 🧠 Logic in Short: Compare: |s[i] - s[i-1]| with |s[n-i] - s[n-i-1]| If all match → ✅ Funny Else → ❌ Not Funny ⚡ Example: Input: acxz → Output: Funny Input: bcxz → Output: Not Funny Consistency in small optimizations builds strong problem-solving skills over time. #Day94 #100DaysOfCode #CodingJourney #HackerRank #CProgramming #ProblemSolving #DeveloperLife #LearnToCode #CodeDaily
To view or add a comment, sign in
-
🚀 Day 24 | 100 Days of Coding Challenge #DrGViswanathanChallenge 📘 Problem Solved: Divide Two Integers (LeetCode) 🔧 *Approach Used (Simulation without /, , %): • Determined the sign of the result based on inputs • Converted numbers to absolute values for easier handling • Repeatedly added the divisor until reaching the dividend • Carefully handled overflow edge cases ⏳ Complexity: Time: O(n / d) Space: O(1) 🧠 Key Learning: Even basic operations like division can be implemented using logic and constraints. Handling edge cases (INT_MIN, overflow) is crucial. 💡 Optimization Insight: This approach can be improved to O(log n) using bit manipulation (doubling method). 📂 Topics Covered: Math, Bit Manipulation, Edge Cases #100DaysOfCode #DSA #CPP #LeetCode #CodingJourney #CompetitiveProgramming
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