Day 44 of my #50DaysOfCode challenge is done ✅ 📌 Problem Solved Check Palindrome Using Recursion We were given a string s. Task was to check whether it is a palindrome. But using recursion. 💻 Approach (Recursion + Two Pointers) 🔹️Take two pointers: start and end. 🔹️Base case: ▪️If start >= end → return true 🔹️Compare characters at start and end. 🔹️If they are not equal → return false 🔹️If equal → move inward ▪️start + 1 ▪️end - 1 🔹️Call function again for inner substring Keep checking till center. 📊 Complexity Analysis Time Complexity: O(n) Space Complexity: O(n) Due to recursion stack. 📚 What I learned today: ▫️Recursion can simulate two-pointer traversal. ▫️Base condition defines when to stop checking. ▫️Breaking problem into smaller substrings simplifies logic. ▫️Recursive calls use stack space internally. Day 44 completed. Combining recursion with pointers 🚀 #50DaysOfCode #CodingChallenge #Consistency #LearningInPublic
Palindrome Check Using Recursion and Two Pointers
More Relevant Posts
-
Day 45 of my #50DaysOfCode challenge is done ✅ 📌 Problem Solved Check Palindrome Using Recursion We were given a string s. Task was to check whether it is a palindrome. Using recursion. --- 💻 Approach (Recursion + Two Pointers) 🔹️Take two pointers: start and end. 🔹️Base case: ▪️If start >= end → return true 🔹️Compare characters at start and end. 🔹️If not equal → return false 🔹️If equal → move inward ▪️start + 1 ▪️end - 1 🔹️Call function again for inner substring Keep checking until pointers meet. --- 📊 Complexity Analysis Time Complexity: O(n) Space Complexity: O(n) Due to recursion stack. --- 📚 What I learned today: ▫️Recursion can replicate iterative two-pointer logic. ▫️Each recursive call reduces problem size by 2. ▫️Base condition ensures termination at center. ▫️Space complexity increases due to call stack. Day 44 completed. Recursion patterns getting stronger 🚀 #50DaysOfCode #CodingChallenge #Consistency #LearningInPublic
To view or add a comment, sign in
-
🚀 Day 66 of #100DaysOfCode Today, I solved LeetCode 73 – Set Matrix Zeroes, a classic problem that tests in-place matrix manipulation and optimization techniques. 💡 Problem Overview: Given a matrix, if any cell contains 0, its entire row and column must be set to 0. The challenge is to perform this efficiently without using excessive extra space. 🧠 Approach: To solve this optimally, I focused on: ✔️ Using the first row and first column as markers ✔️ Tracking whether the first row/column initially contained zero ✔️ Updating the matrix in-place based on these markers This avoids using additional space and achieves optimal performance. ⚡ Key Takeaways: In-place algorithms help reduce space complexity Using matrix itself as storage is a powerful optimization trick Handling edge cases (first row/column) is critical 📊 Complexity Analysis: Time Complexity: O(n × m) Space Complexity: O(1) Improving problem-solving skills one day at a time 🚀 #LeetCode #100DaysOfCode #DSA #Matrix #ProblemSolving #CodingJourney #SoftwareDevelopment #InterviewPrep
To view or add a comment, sign in
-
-
🚀 Day 68 of #100DaysOfCode 🔥 Solved Median of Two Sorted Arrays (LeetCode Q4) today! 💡 Problem Insight: Find the median of two sorted arrays in an efficient way without merging them. 🧠 Approach: - Use Binary Search on the smaller array - Partition both arrays such that left side has smaller elements and right side has larger ones - Ensure correct balance of elements on both sides ⚙️ Algorithm: - Apply binary search to find correct partition - Check conditions for valid split - If valid → calculate median based on total length - Else → adjust search space ⏱️ Complexity: - Time: O(log(min(n, m))) - Space: O(1) 📌 Key Learning: Brute force is not always the answer — smart partitioning can optimize everything. 💬 Think smart, not hard. #DSA #LeetCode #BinarySearch #100DaysOfCode #CodingJourney #ProblemSolving #Consistency
To view or add a comment, sign in
-
-
Solved “Letter Combinations of a Phone Number” on LeetCode 💡 What looks simple on the surface is actually a clean exercise in recursion + backtracking. 🔍 Key takeaways: - Mapping digits to characters is straightforward, but generating all combinations efficiently is where the thinking comes in - Backtracking helps explore all possibilities while keeping the solution clean and scalable - Important to control recursion depth and maintain state (temp) correctly 💭 What I focused on: - Building combinations incrementally - Reverting state after each recursive call (classic backtracking pattern) - Keeping the solution readable and modular This problem reinforced how powerful recursion is when combined with proper state management. On to the next one 🚀 #DSA #LeetCode #Backtracking #Recursion #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
📄 New preprint published on Zenodo today. FlowBridge: A Zero-Cost Generalized Framework for Cross-Platform Email-to-Messaging Automation Using Browser Automation in Containerized Virtual Display Environments. 5 named subsystems: → DedupGuard — multi-signal deduplication → ClipCast — Unicode injection bypassing ChromeDriver BMP limit → SessionHeal — self-healing browser sessions in Docker → SheetConfig — spreadsheet-as-configuration → BatchForge — message aggregation engine Production result: 100% delivery accuracy, zero duplicates, $0/month infrastructure. Sole-author preprint #5. Open source. MIT license. DOI: https://lnkd.in/gidKy6BQ GitHub: https://lnkd.in/ge3RaEUr Full deep-dive article coming this week. #FlowBridge #OpenSource #Research #Zenodo #Automation #Docker #Python
To view or add a comment, sign in
-
Day 46 of my #50DaysOfCode challenge is done ✅ 📌 Problem Solved Geometric Sum using Recursion We were given an integer n. Task was to find the sum: 1 + 1/3 + 1/3² + ... + 1/3ⁿ Using recursion. 💻 Approach 🔹️Define a recursive function sum(n). 🔹️Base case: ▪️If n == 0 → return 1 🔹️Recursive case: ▪️Return sum(n-1) + 1/(3ⁿ) Each call adds one term. And moves toward smaller n. 📊 Complexity Analysis Time Complexity: O(n) Space Complexity: O(n) Due to recursion stack. 📚 What I learned today: ▫️Recursion can be used for summation of series. ▫️Each recursive call adds one term to the result. ▫️Understanding base case is important to stop recursion. ▫️Power calculations are common in series problems. Day 46 completed. Getting more comfortable with recursive formulas 🚀 #50DaysOfCode #CodingChallenge #Consistency #LearningInPublic
To view or add a comment, sign in
-
Day 30 of #100DaysOfCode 💻 Today’s focus: Permutation Problem Worked on generating all permutations of an array using recursion + backtracking. This problem really tested my understanding of decision trees and tracking visited elements. What stood out today: Every choice creates a new path — and managing those choices efficiently is the key. It’s interesting how a problem that looks simple at first quickly turns into a deep exercise in logic building and control over recursion. Slowly getting more comfortable with backtracking patterns 🚀 #DSA #Backtracking #Recursion #CodingJourney #LeetCode #Consistency #Day30
To view or add a comment, sign in
-
-
🚀 Day 78 of #100DaysOfCode Today, I solved LeetCode 154 – Find Minimum in Rotated Sorted Array II, a problem that focuses on binary search and handling edge cases with duplicates. 💡 Problem Overview: Given a rotated sorted array that may contain duplicates, the goal is to find the minimum element efficiently. 🧠 Approach: ✔️ Applied modified binary search ✔️ Compared mid element with the right boundary ✔️ Carefully handled duplicate values to avoid incorrect elimination of search space This approach ensures correctness even when duplicates are present. ⚡ Key Takeaways: Binary search can be adapted for complex scenarios Duplicates introduce edge cases that must be handled carefully Choosing the correct condition is key to narrowing the search space 📊 Complexity Analysis: Time Complexity: O(log n) (average), O(n) (worst case due to duplicates) Space Complexity: O(1) Strengthening problem-solving with optimized approaches 🚀 #LeetCode #100DaysOfCode #DSA #BinarySearch #ProblemSolving #CodingJourney #SoftwareDevelopment #InterviewPrep
To view or add a comment, sign in
-
-
🚀 Day 82 of #100DaysOfCode Today, I solved LeetCode 41 – First Missing Positive, a classic hard problem that tests in-place array manipulation and optimization. 💡 Problem Overview: Given an unsorted array, the goal is to find the smallest missing positive integer in O(n) time and O(1) space. 🧠 Approach: ✔️ Used index-based placement (cyclic sort idea) ✔️ Placed each number x at index x - 1 whenever possible ✔️ Ignored negative numbers and values out of range ✔️ Finally, scanned the array to find the first index where the value is incorrect This ensures optimal time and space complexity without using extra data structures. ⚡ Key Takeaways: In-place manipulation can eliminate the need for extra space Index mapping is a powerful trick for array problems Hard problems often rely on simple but clever observations 📊 Complexity Analysis: Time Complexity: O(n) Space Complexity: O(1) Solving challenging problems and strengthening core fundamentals 🚀 #LeetCode #100DaysOfCode #DSA #Arrays #ProblemSolving #CodingJourney #SoftwareDevelopment #InterviewPrep #HardProblems
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