Day 17/100 – Consistency in Action Today’s problem: LeetCode 392 – Is Subsequence A simple-looking problem, but a great reminder that strong fundamentals matter. I implemented the Two Pointer Approach to efficiently determine whether one string is a subsequence of another — achieving an optimal solution with O(n) time complexity and O(1) space. What I learned today: • How to think in terms of relative order instead of exact matching • Why greedy traversal works perfectly in subsequence problems • Importance of choosing the right approach over brute force • Strengthening problem-solving intuition for interviews Every day may not feel big, but these consistent efforts are slowly building confidence and clarity On to Day 18 #Day17 #100DaysOfCode #DSA #LeetCode #Python #CodingJourney #Consistency #ProblemSolving #TechJourney
LeetCode 392 - Is Subsequence with Two Pointer Approach
More Relevant Posts
-
#𝐃𝐚𝐲𝟏𝟏 – 𝐌𝐚𝐱𝐢𝐦𝐢𝐳𝐞 𝐭𝐡𝐞 𝐃𝐢𝐬𝐭𝐚𝐧𝐜𝐞 𝐁𝐞𝐭𝐰𝐞𝐞𝐧 𝐏𝐨𝐢𝐧𝐭𝐬 𝐨𝐧 𝐚 𝐒𝐪𝐮𝐚𝐫𝐞 🚀 📝 Select k points on square boundary → maximize min Manhattan distance. 💡 Pattern: Binary Search on answer + Greedy validation. 🔧 Key trick: Unfold boundary into a line of length 4×side. ✅ O(n log n) time | O(n) space Maximin problems = Binary Search 🎯 #LeetCode #DSA #Python #CodingChallenge #100DaysOfCode #ProblemSolving #SoftwareEngineering #Consistency #CareerPointUniversity #KotaCoders #BinarySearch #Greedy #Geometry
To view or add a comment, sign in
-
-
🚀 Day 40 – LeetCode Journey Today’s problem: Linked List Cycle ✔️ Solved using Floyd’s Cycle Detection Algorithm (Tortoise & Hare) ✔️ Used two pointers (slow & fast) ✔️ Efficient cycle detection without extra space 💡 Key Insight: If a cycle exists, the fast pointer will eventually meet the slow pointer. This approach avoids using extra memory and works in O(n) time. This problem strengthened my understanding of linked lists and pointer techniques. 40 days of consistency — getting stronger every day 💪🔥 #LeetCode #Day40 #LinkedList #TwoPointers #Python #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Reorder Linked List: Split, Reverse, Merge Pattern Reordering a linked list looks tricky at first, but it becomes clean once you break it into three deterministic steps: Find the middle Reverse the second half Merge both halves alternately The key insight is: instead of trying to rearrange nodes in one pass, decompose the problem into simpler sub-problems you already know how to solve efficiently. Complexity: Time: O(n) | Space: O(1) Takeaway: Many linked list problems follow a hidden pattern: 👉 Split → Transform → Merge Once you recognize this, problems like palindrome check, reorder list, and even some cycle-based problems become much easier. #LinkedList #TwoPointers #InPlaceAlgorithms #CodingInterview #ProblemSolving #Python #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 Day 62 of #100DaysOfCode Solved “Remove Nth Node From End of List” 🔗 💡 Today’s focus: Two Pointer Technique (Fast & Slow pointers) Instead of calculating length, I used an efficient one-pass approach to remove the target node. 🧠 Key Learnings: Dummy node helps handle edge cases (like removing head) Fast pointer moves n steps ahead Then move both pointers until fast reaches the end Slow pointer lands just before the node to delete ⚡ Clean, efficient & optimal solution (O(n) time, O(1) space) Consistency is starting to feel powerful now 💪 #DSA #LeetCode #CodingJourney #LinkedInLearning #100DaysOfCode #Day62 #Python #ProblemSolving
To view or add a comment, sign in
-
-
Solved 𝗟𝗖 𝟮𝟲𝟰𝟬 · Find the Score of All Prefixes of an Array (Medium) First glance at the problem? Skimmed it, saw "prefix" and some operation on elements — 𝗮𝘀𝘀𝘂𝗺𝗲𝗱 𝗶𝘁 𝘄𝗮𝘀 𝘀𝗼𝗺𝗲𝘁𝗵𝗶𝗻𝗴 𝗹𝗶𝗸𝗲 𝘀𝗾𝘂𝗮𝗿𝗶𝗻𝗴. Wrote code. Wrong answer. Read the statement properly this time. Turns out conver[i] = arr[i] + max(arr[0..i]) — each element gets added to the 𝗿𝘂𝗻𝗻𝗶𝗻𝗴 𝗺𝗮𝘅 up to that index. The score of a prefix is just the sum of its conversion array. Track 𝗺𝗮𝘅_𝘀𝗼_𝗳𝗮𝗿 as you iterate, add it to the current element, accumulate into score. 𝗢𝗻𝗲 𝗽𝗮𝘀𝘀, 𝗱𝗼𝗻𝗲. Day 39 — #1000DaysOfLearning #DSA #LeetCode #Python #1000DaysOfLearning #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Day 41 – LeetCode Journey Today’s problem: Add Binary ✔️ Implemented binary addition manually ✔️ Handled carry propagation efficiently ✔️ Worked with string manipulation and indexing 💡 Key Insight: Binary addition follows the same rules as decimal addition, but with base 2. Managing the carry correctly is the key to building the final result. This problem improved my understanding of bit-level operations and string handling. Step by step, mastering the fundamentals 🔥💪 #LeetCode #Day41 #Binary #Strings #Python #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Beyond String Concatenation When I started, I used to concatenate strings the old-school way. It was messy, prone to errors, and hard to read The Problem: Using + requires manual type conversion (like str(21)) and gets confusing with all the extra quotes and spaces Solution: F-strings Introduced in Python 3.6, F-strings makes your code: ✅ Readable: You see the full sentence structure ✅ Fast: They are more efficient than older methods ✅ Flexible: You can perform math or call methods directly inside { } It’s a small concept, but it’s one of the easiest ways to make code look 10x more professional. #Python #30DaysOfCode #BCA #LearningInPublic #Day21 #JECRC Day 21/30
To view or add a comment, sign in
-
-
🚀 Day 48 – LeetCode Journey Today’s challenge: Substring with Concatenation of All Words ✔️ Solved using sliding window + hashmap ✔️ Processed string in fixed-length chunks ✔️ Tracked word frequency efficiently 💡 Key Insight: Instead of checking every substring blindly, splitting the string into word-sized pieces and using a hashmap helps validate matches efficiently. Sliding window keeps the solution optimized. This problem was a great exercise in string manipulation, hashing, and window techniques 🧠 Consistency is the real game changer 🚀 #LeetCode #Day48 #SlidingWindow #HashMap #Strings #Python #ProblemSolving #CodingJourney #100DaysOfCode https://lnkd.in/gxf4RBT6
To view or add a comment, sign in
-
Just solved a classic DSA problem: Valid Parentheses Check using a stack! This problem is a great example of how a simple concept like a stack can help solve real interview-level questions efficiently. In the video, I walk through the logic step-by-step and implement it in Python in a clean and beginner-friendly way. If you're preparing for coding interviews or strengthening your DSA fundamentals, this one is definitely worth your time. 🎥 Check out the full explanation in the given link. Would love to hear how you approached this problem or if you have alternative solutions! #datastructures #algorithms #python #codinginterview #softwareengineering #learning #dsa https://lnkd.in/g8AdYW6J
2. Check for Balanced Parentheses (Python) | DSA 💻 - PRACTICE PROBLEM
https://www.youtube.com/
To view or add a comment, sign in
-
📌 Problem: Merge Strings Alternately 💡 Approach: Used a simple two-pointer / iteration technique to merge both strings character by character. First, iterate up to the minimum length of both strings and append alternately. Then, append the remaining characters from the longer string. ⚙️ Key Insight: Handle unequal string lengths separately Avoid index out-of-bounds by iterating till min(len(word1), len(word2)) ⏱️ Time Complexity: O(n + m) 📦 Space Complexity: O(n + m) merg 📚 What I learned: String manipulation efficiently Handling edge cases when lengths differ #LeetCode #DSA #Coding #ProblemSolving #Python #SoftwareDevelopment #CodingJourney
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