Day 31 / 100 – Add Strings (LeetCode #415) Today’s challenge was all about simulating manual addition without using any built-in integer conversions. Given two numbers as strings, the task was to return their sum — also as a string. This problem really emphasized the importance of breaking problems into small, logical steps rather than relying on shortcuts. 🔍 Key Learnings Recreated the digit-by-digit addition process using ASCII values. Practiced handling carry-over efficiently while iterating backward. Strengthened my understanding of string manipulation and arithmetic logic. 💭 Thought of the Day True problem-solving isn’t about using built-ins — it’s about understanding how things work underneath. Today reminded me that mastery grows when we rebuild the basics from scratch, not when we avoid them. 🔗 Problem Link: https://lnkd.in/gHMt9vj9 #100DaysOfCode #Day31 #LeetCode #Python #ProblemSolving #StringManipulation #Algorithms #DataStructures #CodingChallenge #CodeEveryday #TechGrowth #LearningJourney
Adding Strings without Built-in Conversions on LeetCode #415
More Relevant Posts
-
DAY-1:CODING CHALLENGE 1.Longest common Prefix substring from given string as input 2.3SUM problem Started with BRUTE-FORCE → checked every triplet. 😀 Worked 😇 but SLOW for big arrays (O(n³)) → TIME LIMIT EXCEEDED. Faced errors along the way: 'int object not iterable' → I wrote sorted(a,b,c) instead of sorted([a,b,c]). 'unhashable type: list' → Tried adding list to set. Fixed by converting to tuple. LOGICAL BUG → Return inside the loop returned early. Fixed by moving return outside. Finally moved to OPTIMAL TWO-POINTER APPROACH: Sort array first. Use two pointers to find pairs for target -nums[i]. Skip duplicates carefully. Complexity reduced to O(n²). 💡 Lessons learned: small syntax mistakes can cause big errors, immutable types are key for sets, and proper pointer logic makes code efficient. #Python #Algorithms #LeetCode #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Day 3 of #100DaysOfLeetCode Problem: 167. Two Sum II – Input Array Is Sorted Category: Arrays / Two Pointers Today’s challenge was all about finding two numbers in a sorted array that add up to a given target. Since the array is already sorted, using two pointers gives an elegant O(n) solution — no need for extra space! 🧠 Key Learnings: Initialized pointers at both ends (l = 0, r = n-1). If the sum is smaller than the target → move left pointer rightward. If the sum is greater → move right pointer leftward. Found the exact indices in linear time using smart pointer movement. 💡Time Complexity: O(n) 💡 Space Complexity: O(1) 🎯 Takeaway: When the array is sorted, two pointers can replace complex hash-based logic, simplifying both time and space usage. Staying consistent and learning one problem at a time! 💪 #LeetCode #100DaysOfCode #ProblemSolving #CodingJourney #Arrays #TwoPointers #Python #AIEngineer #Consistency
To view or add a comment, sign in
-
-
💻 2011: Final Value of Variable After Performing Operations Today’s challenge was a simple yet interesting warm up problem that tests how efficiently we can track changes in a variable through a series of operations. 🧠 Concept: We start with X = 0, and perform operations like ++X, X++, --X, and X--. Each increment or decrement modifies X by 1, the task is to return the final value after performing all operations. ⚙️ Approach: - A straightforward solution: - Iterate through all operations. - Increment count by 1 for ++ or X++. - Decrement count by 1 for -- or X--. - Return the final count. Even though it’s an easy problem, it’s a great reminder that clarity and precision matter, small details in logic can make a big difference. #LeetCode #Python #CodingPractice #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
#96day of #100DaysOfCode 🌱 LeetCode 109: Convert Sorted List to Binary Search Tree Today’s challenge was about building balance — literally! Given a sorted linked list, we need to convert it into a height-balanced BST 🌳 🧠 Key Idea: The middle element of the list becomes the root. Left half forms the left subtree, right half forms the right subtree. Use slow–fast pointers to find the middle efficiently. 📈 Complexity: Time: O(n log n) Space: O(log n) (recursion stack) 💬 Learning: Balance matters — in trees, in code, and in life 🌿 Sometimes, the middle point creates the strongest foundation. #LeetCode #DSA #BinarySearchTree #LinkedList #CodingChallenge #Python #Algorithm #LeetCodeDaily #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Just wrapped up a deep‑dive into NumPy and Python functions! 📊💻 🔹 Built arrays, checked shapes & dimensions, and explored broadcasting. 🔹 Wrote reusable functions – from Fibonacci & grade calculators to life‑phase checkers. 🔹 Played with random data, slicing, and basic stats (mean, var, std). Big shout‑out to the open‑source community for making data‑science so approachable. #Python #NumPy #DataScience #Coding #LearningInPublic
To view or add a comment, sign in
-
Day 16 of #100DaysOfLeetCode Today’s problem focused on substring counting within binary strings and required an efficient approach to handle potentially large input sizes without generating every substring explicitly. 1. Number of Substrings With Only 1s The task was to count the total number of substrings that consist entirely of the character '1', with the final result taken modulo (10^9 + 7). Instead of constructing the substrings, the key insight is that each continuous block of 1s contributes a predictable number of valid substrings. 🔹 My Approach: Iterated through the string while tracking the current streak length of consecutive 1s. Each time a block ended, computed the number of substrings from that block using the formula: k*(k+1)/2 where k is the length of the streak. Added the total from each block to the final answer, applying the modulo constraint throughout. Completed the process with a final update for any trailing block of 1s. What I Learned: This problem reinforces how recognizing mathematical patterns within sequences can transform a brute-force solution into a simple linear scan. Efficient substring counting often comes down to understanding structure rather than enumerating possibilities. 📊 Complexity Analysis: Time Complexity: O(n) — single pass over the string. Space Complexity: O(1) — constant space approach. #day16 #100daysofleetcode #leetcode #DSA #python #leetcodes #striver
To view or add a comment, sign in
-
-
Happy Friday and Shabbat Shalom ✡️ No-code tools like n8n are useful for fast prototypes. But serious automation happens when you move to Python and libraries like LangChain. That’s where you can design true AI agents, systems that think, plan, and execute tasks across APIs and data sources using these far more expressive tools. Quick overview in the video. #AIAgents #Python #Automation
To view or add a comment, sign in
-
🚀 Day 46 of #100DaysOfDSA Solved LeetCode Problem #257 – Binary Tree Paths 🌿➡️🌿 📌 Problem Insight: Given the root of a binary tree, the task is to return all root-to-leaf paths as strings. Each path should follow the format: root -> child -> ... -> leaf This is a classic DFS + recursion problem that builds strong tree traversal skills. 💡 Key Learnings: Practiced Depth-First Search (DFS) to explore root-to-leaf paths. Understood how to accumulate path strings during recursive calls. Learned to identify leaf nodes and finalize completed paths. Time Complexity: O(n) — visit each node once. Space Complexity: O(h) — recursion stack height (h = tree height). 👉 Tree problems teach us to explore step by step — each decision builds the full path 🌳💡 #LeetCode #DSA #ProblemSolving #100DaysChallenge #Day46 #CodingJourney #Python #BinaryTree #DFS
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