Day 10 of #100DaysOfLeetCode Problem: 2. Add Two Numbers Category: Linked List / Math / Simulation Today’s challenge involved adding two non-empty linked lists that represent numbers in reverse order. Each node contains a single digit, and the goal is to return a linked list representing their sum. 🧠 Key Learnings: Traversed both linked lists simultaneously while managing a carry variable. Handled cases where one list is shorter than the other using conditional checks. Understood how to perform arithmetic operations directly through node manipulation. Strengthened my logic for digit-by-digit processing and linked list traversal. 🎯 Takeaway: Working with linked lists for mathematical operations builds strong logical thinking — especially when managing carry, edge cases, and node creation dynamically. #LeetCode #100DaysOfCode #ProblemSolving #CodingJourney #LinkedList #Python #AIEngineer #Consistency
Adding Two Numbers with Linked Lists in LeetCode Challenge
More Relevant Posts
-
Day 8 of #100DaysOfLeetCode Problem: 9. Palindrome Number Category: Math / Two Pointers / Logic Today’s problem focused on determining whether an integer reads the same backward as forward — essentially checking if a number is a palindrome. 🧠 Key Learnings: Reversed the number mathematically using modulo and integer division. Avoided converting integers to strings, focusing purely on arithmetic logic. Understood how to handle special cases like negative numbers and numbers ending with zero. Strengthened my skills in digit manipulation and loop-based reversal logic. 🎯 Takeaway: Sometimes, avoiding built-in functions helps build a deeper understanding of fundamental logic — every digit and operation counts! #LeetCode #100DaysOfCode #ProblemSolving #CodingJourney #Math #LogicBuilding #Python #AIEngineer #Consistency
To view or add a comment, sign in
-
-
🚀 Day 40 of #100DaysOfDSA Solved LeetCode Problem #69 – Sqrt(x) 🧮 💡 Problem Insight: Given a non-negative integer x, return the square root of x rounded down to the nearest integer. For example: Input: x = 8 Output: 2 (since √8 ≈ 2.828, and floor(2.828) = 2) ✨ Key Learnings: Practiced binary search to find results efficiently without using built-in math functions. Learned how to narrow down search space based on mid-square comparisons. Reinforced understanding of integer division and rounding down behavior. Time Complexity: O(log n) — fast and efficient! Space Complexity: O(1) 💬 Lesson: Binary Search isn’t just for sorted arrays — it’s a mindset for narrowing down possibilities quickly 🚀 #LeetCode #Python #DSA #BinarySearch #ProblemSolving #100DaysOfCode #Day40 #CodingJourney
To view or add a comment, sign in
-
-
Another LeetCode problem solved: 507. Perfect Number. While the standard approach involves calculating divisors , I took a step back and looked at the constraints. For the range 1<num<10^8, there are only a handful of known Perfect Numbers (6, 28, 496...). Leveraging this mathematical insight allowed for an O(1) time complexity lookup, resulting in a 0 ms runtime and a 100% beat! This is a great reminder that efficient coding often starts with mathematical analysis, not just algorithm design. Have you ever found a great mathematical shortcut like this in a coding problem? Share your insights! 👇 #LeetCode #ProblemSolving #Algorithms #Optimization #Mathematics #Python #Coding
To view or add a comment, sign in
-
-
✨ Leetcode #3370: Smallest Number With All Set Bits Today, I solved an interesting bit manipulation problem where the task was to find the smallest number greater than or equal to a given n, such that its binary representation contains only set bits (1s). 🔍 Concept Overview: - This problem beautifully highlights the power of bit manipulation and mathematical insight. - The key lies in observing the pattern of numbers that have all bits set, like 1, 3, 7, 15, 31, etc. - These numbers can be represented in a uniform mathematical form, which makes the solution both elegant and efficient. 💡 Key Learning: - Understanding how bit shifting and logarithmic operations can simplify problems involving binary representations. - Reinforcing the importance of pattern recognition in bit level problems. - Appreciating how a constant time solution can emerge from strong mathematical reasoning. 🧠 Complexity: O(1) A pure logic based solution; concise, optimal, and satisfying! #LeetCode #BitManipulation #Coding #ProblemSolving #Python #LearningEveryday #DataStructuresAndAlgorithms
To view or add a comment, sign in
-
-
🗓 Day 12 / 100 – #100DaysOfLeetCode 📌Problem 3234: Count the Number of Substrings With Dominant Ones A substring is considered to have dominant ones if: Number of 1s ≥ (Number of 0s)² The challenge was to count how many substrings in the binary string satisfy this condition. 🧠 My Approach: Iterated through substrings while tracking zero count and one count. Used the condition ones ≥ zeros² to determine validity. Applied early stopping when zeros became large, since the condition becomes much harder to meet as zeros grow. This pruning helped avoid unnecessary checks and made the approach more efficient. 💡 Key Learning: This problem highlights how mathematical constraints can simplify substring evaluation. Understanding how zeros grow quadratically in the condition helped shape a smarter, more optimized checking approach rather than brute-force enumeration. A great exercise in reasoning about substring properties and designing early-exit logic. Consistent effort… consistent progress 🚀 #100DaysOfLeetCode #LeetCodeChallenge #Python #ProblemSolving #BinaryStrings #StringAlgorithms #Optimization #LogicBuilding #DataStructures #Algorithms #DSA #CompetitiveProgramming #CodingJourney #SoftwareEngineering #LearningInPublic #TechStudent #DeveloperJourney #CareerGrowth #CodeEveryday #CodingCommunity #KeepLearning #Programmer
To view or add a comment, sign in
-
-
Day 66: Find Minimum in Rotated Sorted Array II 📉 (Simple Version) I'm tackling an advanced Binary Search problem on Day 66 of #100DaysOfCode: "Find Minimum in Rotated Sorted Array II." The challenge is to find the minimum element in a rotated sorted array that may contain duplicates. My solution uses a modified Binary Search approach. The key difficulty is when the middle element (nums[mid]) equals the rightmost element (nums[right]). In this case, we can't tell if the minimum is on the left or the right. To resolve this ambiguity, I simply discard the rightmost element by setting right -= 1. This adjustment keeps the search on track, achieving an optimal O(log n) complexity in the typical case. My solution achieved 100% runtime efficiency! #Python #DSA #Algorithms #BinarySearch #Arrays #100DaysOfCode #ProblemSolving
To view or add a comment, sign in
-
-
Day 13 of #100DaysOfLeetCode Problem: 88. Merge Sorted Array Category: Arrays / Sorting / Two Pointers Today’s challenge focused on merging two sorted arrays into one, maintaining the sorted order. It’s a simple yet powerful problem that tests your understanding of array indices, merging logic, and in-place updates. 🧠 Key Learnings: Extended the first array by adding elements from the second, then sorted the combined list. Reinforced the importance of efficient merging techniques for sorted sequences. Understood how in-place operations can reduce memory usage in practical scenarios. Strengthened logic building around sorting fundamentals and index-based insertion. 🎯 Takeaway: Even simple array problems help build strong fundamentals in sorting and data manipulation — the key to mastering larger algorithmic challenges. #LeetCode #100DaysOfCode #ProblemSolving #CodingJourney #Arrays #Sorting #Python #AIEngineer #Consistency
To view or add a comment, sign in
-
-
Day 30 / 100 – Majority Element II (LeetCode #229) Today’s challenge was all about identifying numbers that appear more than ⌊ n/3 ⌋ times in an array. This problem was a great way to explore the Boyer–Moore Voting Algorithm, an elegant and efficient method to find potential majority elements without using extra space. 🔍 Key Learnings Understanding how counters and candidates evolve in an iterative approach Strengthening logic for pattern recognition and frequency analysis Realizing how efficient algorithms can reduce time and memory usage 💭 Thought of the Day Consistency isn’t just about showing up — it’s about learning smarter each day. Every new problem isn’t a repetition; it’s a refinement of logic and discipline. 🔗 Problem Link:https://lnkd.in/gfiGVueC #100DaysOfCode #Day30 #LeetCode #Python #ProblemSolving #CodingChallenge #DataStructures #Algorithms #LearningJourney #CodeEveryday #TechGrowth
To view or add a comment, sign in
-
-
During research, I couldn’t find single, all-in-one sources about transformer ML implementation. There are some nice mathematical paper (such as those by John Thickstun), but they’re not easy for IT engineers due to advance equations. Moreover, all samples are #python programming, #pytorch or #tensorflow lib. based. Hard to find complete core logic samples. I like simple document like "The Transformer Model in Equations" by John Thickstun. In this image, I tried to simplfy steps from my previous AWK script. Colored picture is training flow (Forward) , ASCII style flow is Forward and Backward pass steps. It simpler than math papers. Because like pseudo-code flow. (let me know if pic quality is low) #noHashTagAnyMoreInLinkedin ?
To view or add a comment, sign in
-
-
💻 Day 59 of #100DaysOfCode Solved LeetCode Problem 1716: Calculate Money in Leetcode Bank (Easy) 🏦 This problem involves a weekly incremental saving pattern — each Monday starts with a higher base deposit, and daily savings increase sequentially throughout the week. 🔹 Concepts Applied: Arithmetic Progression (AP) Modular division for week/day tracking Mathematical optimization (O(1) solution) ✅ Runtime: 0 ms — Beats 100% ✅ Memory: 17.94 MB This problem highlights how mathematical patterns can simplify what initially seems iterative into an elegant constant-time formula. #LeetCode #CodingJourney #Python #ProblemSolving #100DaysOfCode #MathematicsInProgramming #CodeOptimization #LearningEveryday
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