🚀 Day 44/60 — LeetCode Discipline Problem Solved: Regular Expression Matching Difficulty: Hard Today’s problem was one of the toughest so far. It involved implementing regex matching with support for: • '.' → matches any single character • '*' → matches zero or more of the previous element 💡 Key Insight: This problem is solved using Dynamic Programming + Recursion (Memoization). Instead of checking blindly, we store intermediate results to avoid recomputation. 💡 Key Learnings: • Understanding recursion deeply • Using memoization to optimize overlapping subproblems • Handling multiple cases carefully (especially '*') • Thinking in terms of states → dp(i, j) ⚡ Performance: Runtime: 6 ms Like solving a maze… every wrong turn teaches something— and every remembered path saves time. This wasn’t just coding— this was strategy. #leetcode #coding #programming #developer #softwareengineer #codinglife #coders #code #python #java #cpp #javascript #webdevelopment #machinelearning #ai #artificialintelligence #datascience #100daysofcode #60daysofcode #dsa #datastructures #algorithms #dynamicprogramming #dp #recursion #memoization #backtracking #hardproblem #codingchallenge #dailycoding #problem-solving #codingjourney #tech #technology #developerlife #programmerlife #learncoding #codingcommunity #codersofinstagram #instacoder #techlife #devcommunity #softwaredeveloper #engineerlife #codingmotivation #growthmindset #consistency #nevergiveup #studentlife #btech #computerscience #aiml #futureengineer #placements #internship #careergoals #studygram #learning #keepgoing #successmindset #hustle #grind #explorepage #trending #viral #reels #linkedinpost #github #opensource #100xdev #faangprep #interviewprep
LeetCode Regular Expression Matching with Dynamic Programming
More Relevant Posts
-
🚀 Day 45/60 — LeetCode Discipline Problem Solved: Merge Two Sorted Lists Difficulty: Easy (but conceptually powerful) Today’s problem focused on merging two sorted linked lists into one. 💡 Approach: • Use a dummy node to simplify handling • Compare nodes one by one • Attach the smaller node to the result • Move forward step by step • Finally, attach remaining nodes 💡 Key Learnings: • Linked list traversal clarity • Importance of dummy node (clean code) • Pointer manipulation without confusion • Writing optimal and readable logic ⚡ Performance: Runtime: 0 ms Sometimes growth is not about complexity… it’s about mastering simplicity. Small problems sharpen your fundamentals— and strong fundamentals build unstoppable coders. #leetcode #coding #programming #developer #softwareengineer #codinglife #coders #code #python #java #cpp #javascript #webdevelopment #machinelearning #ai #artificialintelligence #datascience #100daysofcode #60daysofcode #dsa #datastructures #algorithms #linkedlist #pointers #codingchallenge #dailycoding #problem-solving #codingjourney #tech #technology #developerlife #programmerlife #learncoding #codingcommunity #codersofinstagram #instacoder #techlife #devcommunity #softwaredeveloper #engineerlife #codingmotivation #growthmindset #consistency #nevergiveup #studentlife #btech #computerscience #aiml #futureengineer #placements #internship #careergoals #studygram #learning #keepgoing #successmindset #hustle #grind #explorepage #trending #viral #reels #linkedinpost #github #opensource #faangprep #interviewprep
To view or add a comment, sign in
-
-
🚀 Day 58/60 — Keeping Only the True Ones Problem Solved: Remove Duplicates from Sorted List II Difficulty: Medium 💡 Approach: • Use a dummy node to handle edge cases • Traverse the list with two pointers (prev & curr) • Detect duplicate groups • Skip all nodes that have duplicates • Keep only distinct values ⚡ Performance: Runtime: 2 ms 💡 What I Learned: • Handling linked list edge cases • Difference between removing duplicates vs removing duplicate values entirely • Pointer manipulation mastery 🌿 Insight: Not everything repeated deserves to stay… Sometimes, strength lies in removing what’s common and preserving only what’s rare. #leetcode #coding #programming #python #dsa #algorithms #linkedlist #datastructures #problem-solving #developer #softwareengineer #100daysofcode #60daysofcode #codingjourney #competitiveprogramming #interviewprep #placements #internship #tech #computerscience #btech #aiml #studentdeveloper #dailycoding #developerlife #codingcommunity #softwaredeveloper #futureengineer #consistency #discipline #growthmindset #learncoding #codersofinstagram #techlife #grind #successmindset #explorepage #trending #linkedlistproblems #interviewquestions #codinglife #techcommunity #buildinpublic #learnbydoing #codeeveryday #nevergiveup #motivation #successjourney
To view or add a comment, sign in
-
-
🚀 From day 16 - day 20 of #100DaysofCode - Python Full Stack Journey Continuing my 100 Days Python Full Stack Learning Challenge at #Codegnan with deeper foundational concepts today! 📌 Day 3 - Technical Learnings. 🔹 File handling 🔹 file handling operations: open,read,write,append,close 🔹 Syntax of file handling 🔹 program execution also done related to file handling Exploring all these it improves my skills and confidence. 📘 Aptitude Learning 🔹 Number series and letter series 🔹 practice problems based on number series and letter series Improving aptitude skills enhances logical thinking and problem solving speed, which are helpful for placement preparation. 🗣️ Soft Skills 🔹 ATS resume creation 🔹 doubts clarification 📈 Day by day Iam improving my skills and confidence it definately help me to express ideas clearly during presentations, interviews and group discussions Building technical skills, logical reasoning and Soft skills all abilities together to become a well-rounded professional GitHubRepository:https://lnkd.in/enuAMbWP 📈 Consistency over intensity! #100Daysofcode #python #fullstackdevelopment #LearningJourney #Day16 - #Day20 #Keeplearning #Aptitude #Softskills #Codegnan
To view or add a comment, sign in
-
𝐃𝐚𝐲 𝟕𝟒/𝟗𝟎 | 𝐁𝐢𝐧𝐚𝐫𝐲 𝐒𝐞𝐚𝐫𝐜𝐡 𝐏𝐫𝐚𝐜𝐭𝐢𝐜𝐞 | 𝐃𝐒𝐀 𝐥𝐞𝐚𝐫𝐧𝐢𝐧𝐠 𝐣𝐨𝐮𝐫𝐧𝐞𝐲. Today I solved 3 important Binary Search problems and focused on understanding patterns clearly. 𝐖𝐡𝐚𝐭 𝐈 𝐩𝐫𝐚𝐜𝐭𝐢𝐜𝐞𝐝: 1️⃣69. Sqrt(x) 2️⃣33. Search in Rotated Sorted Array 3️⃣540. Single Element in a Sorted Array 𝐇𝐨𝐰 𝐈 𝐚𝐩𝐩𝐫𝐨𝐚𝐜𝐡𝐞𝐝 𝐭𝐡𝐞𝐦: 𝟏. 𝐒𝐪𝐫𝐭(𝐱) Brute force: Try every number till square exceeds x Time O(n) Space O(1) Optimal: Use Binary Search on answer space Find last value where mid * mid ≤ x Time O(log n) Space O(1) 𝟐. 𝐒𝐞𝐚𝐫𝐜𝐡 𝐢𝐧 𝐑𝐨𝐭𝐚𝐭𝐞𝐝 𝐒𝐨𝐫𝐭𝐞𝐝 𝐀𝐫𝐫𝐚𝐲 Brute force: Check every element Time O(n) Space O(1) Optimal: Use Binary Search At every step one half is always sorted Check which side is sorted and move accordingly Time O(log n) Space O(1) 𝟑. 𝐒𝐢𝐧𝐠𝐥𝐞 𝐄𝐥𝐞𝐦𝐞𝐧𝐭 𝐢𝐧 𝐒𝐨𝐫𝐭𝐞𝐝 𝐀𝐫𝐫𝐚𝐲 Brute force: Check elements in pairs First mismatch is the answer Time O(n) Space O(1) Optimal: Use Binary Search Use index and pair pattern Decide which side has odd elements Move in that direction Time O(log n) Space O(1) 𝐖𝐡𝐚𝐭 𝐈 𝐮𝐧𝐝𝐞𝐫𝐬𝐭𝐨𝐨𝐝: Binary Search is not only for searching elements It can be used on answer space It can be used on patterns It can be used on conditions 𝐏𝐚𝐭𝐭𝐞𝐫𝐧 𝐭𝐡𝐢𝐧𝐤𝐢𝐧𝐠: At every step just remove the half where answer cannot exist That is the real idea 𝐓𝐚𝐤𝐞𝐚𝐰𝐚𝐲: Understanding when to use Binary Search is more important than just coding it Today helped me get more clarity on applying it in different types of problems Grateful to Anuj Kumar (a.k.a CTO Bhaiya on YouTube) Sir for explaining these concepts in a simple way. 🙏 — Payal Kumari 👩💻🌱 #Day74 #90DaysOfDSA #DSAChallenge #code #LearnCodeCrack #DSAPlaylist #CrackCodingInterviews #CodingJourney #PlacementPrep #BuildInPublic #LeetCode #Algorithms #CodingPractice #JavaDSA #InterviewPreparation #DSA #Consistency #SDE #DSAPatterns #LearningInPublic #coder #DSAJourney #coding #SWE #payalkumari10 #LearningJourney #BabuaDSAPatterns2025 #InterviewPreparationGrateful #BinarySearch #CrackFAANG
To view or add a comment, sign in
-
-
𝐃𝐚𝐲 𝟕𝟔/𝟗𝟎 | 𝐁𝐢𝐧𝐚𝐫𝐲 𝐒𝐞𝐚𝐫𝐜𝐡 + 𝐇𝐞𝐚𝐩 + 𝐏𝐫𝐞𝐟𝐢𝐱 𝐒𝐮𝐦 | 𝐃𝐒𝐀 𝐥𝐞𝐚𝐫𝐧𝐢𝐧𝐠 𝐣𝐨𝐮𝐫𝐧𝐞𝐲. Today I worked on two problems and focused on how different patterns connect. 𝐖𝐡𝐚𝐭 𝐈 𝐩𝐫𝐚𝐜𝐭𝐢𝐜𝐞𝐝: 1️⃣K Weakest Rows in a Matrix 2️⃣Random Pick with Weight 𝐇𝐨𝐰 𝐈 𝐚𝐩𝐩𝐫𝐨𝐚𝐜𝐡𝐞𝐝 𝐭𝐡𝐞𝐦: 𝟏. 𝐊 𝐖𝐞𝐚𝐤𝐞𝐬𝐭 𝐑𝐨𝐰𝐬 𝐢𝐧 𝐚 𝐌𝐚𝐭𝐫𝐢𝐱 Idea: Find rows with minimum soldiers and return top k weakest Approach: Use Binary Search to count soldiers in each row Use a Max Heap to keep only k weakest rows Steps: Count soldiers using Binary Search Store pair of count and index Push into heap If heap size exceeds k, remove strongest Build final result Time O(n log m + n log k) Space O(k) 𝟐. 𝐑𝐚𝐧𝐝𝐨𝐦 𝐏𝐢𝐜𝐤 𝐰𝐢𝐭𝐡 𝐖𝐞𝐢𝐠𝐡𝐭 Idea: Pick index based on weight probability Approach: Use Prefix Sum to convert weights into ranges Use Binary Search to find correct index Steps: Build prefix sum array Generate random number in range of total sum Find first prefix value greater than or equal to target Time: Build prefix sum O(n) Each pick O(log n) Total for m calls O(n + m log n) Space: O(n) 𝐖𝐡𝐚𝐭 𝐈 𝐮𝐧𝐝𝐞𝐫𝐬𝐭𝐨𝐨𝐝: Binary Search is not only for searching values It helps in finding boundaries and ranges Prefix Sum converts problems into range based thinking Heap is useful when we need top k elements 𝐓𝐚𝐤𝐞𝐚𝐰𝐚𝐲: Different problems look different but patterns are similar. Binary Search with Heap and Prefix Sum makes many problems easier. Day by day things are getting clearer. Grateful to Anuj Kumar (a.k.a CTO Bhaiya on YouTube) Sir for explaining these concepts in a simple way. 🙏 — Payal Kumari 👩💻🌱 #Day76 #90DaysOfDSA #DSAChallenge #code #LearnCodeCrack #DSAPlaylist #CrackCodingInterviews #CodingJourney #PlacementPrep #BuildInPublic #LeetCode #Algorithms #CodingPractice #JavaDSA #InterviewPreparation #DSA #Consistency #SDE #DSAPatterns #LearningInPublic #coder #DSAJourney #coding #SWE #payalkumari10 #LearningJourney #BabuaDSAPatterns2025 #InterviewPreparationGrateful #BinarySearch #CrackFAANG
To view or add a comment, sign in
-
-
#100DaysOfLeetcode journey 🚀 Day 67/100 — Optimizing Circular Proximity! Today’s Problem: Minimum Circular Distance to Matching Elements 🔹 The Goal: Given an array that "wraps around," find the shortest path from a specific index to any other occurrence of the same value. 🔹 The Insight: A naive search for every query would be $O(Q \times N)$, which is catastrophic for large datasets. The breakthrough here is Spatial Indexing. By pre-grouping the indices of every value and keeping them sorted, we transform a global search into a localized neighbor check. 🔹 The Logic: Value-to-Index Mapping: I used a HashMap to store sorted lists of indices for each unique number. Logarithmic Search: Using binarySearch, I instantly located the query index within its value-group. The "Circular Sandwich": Because the indices are sorted, the closest matching elements are always the immediate neighbors in the list. By checking the left, the right, and the wrap-around (first/last) elements, we guarantee the global minimum in $O(\log N)$ time. ✨ Achievement: Day 67! Successfully applied pre-computation and binary search to optimize a spatial query problem. Understanding that the "closest" element in a circular topology is always an adjacent neighbor in the sorted index space is a powerful shortcut for range-based problems. 🔍 Steps followed: ✔ Map Pre-processing: Clustered indices for constant-time value lookups. ✔ Binary Search Integration: Optimized neighbor identification to logarithmic time. ✔ Modular Distance Logic: Correctly handled the $N - \text{linearDist}$ calculation for circular boundaries. 🔧 Complexity Analysis: Time Complexity: $O(N + Q \log N)$ Space Complexity: $O(N)$ 67 days down! The logic is getting faster, and the problems are getting more interesting. Let's keep the streak alive! 🛠️ #Java #DSA #LeetCode #CodingJourney #100DaysOfCode #SoftwareEngineer #InternshipBound #Programming #ArrayAlgorithms #BinarySearch #Optimization #Day67
To view or add a comment, sign in
-
-
Auto-commit DSA problems Even though I was solving LeetCode regularly, my GitHub stayed inactive for months. That became a problem when I applied for an internship and was asked for my GitHub profile. That’s when it hit me why not automate this? So I built a Python tool that: Detects when I submit an accepted solution → fetches the code → saves it with proper metadata → and automatically commits it to GitHub every 10 minutes. No manual effort. Just solve problems, and everything else happens in the background. Everything perfectly aligning with the tech stack I was working on: • Python (requests, subprocess, argparse, logging) • LeetCode GraphQL API + Codeforces REST API • Git + Cron This is what I love about programming if something is repetitive or annoying, you can build a system to eliminate it. Currently working smoothly with LeetCode. Codeforces integration is still a work in progress due to API limitations. If you’re grinding DSA, this might help you keep your GitHub consistent without extra effort. Repo: https://lnkd.in/gRdSuC6S edit: cron works with mac/linux, if you are using windows it will need a task scheduler setup and you are good to go (Just phase-1, I have plans to improve this project however it does the immediate work which is automating leetcode submissions. Will share progress soon) #Python #GitHub #LeetCode #DSA #BuildInPublic #Automation #Developers #TechCommunity #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 68/60 — Reversing the Fundamentals Problem Solved: Reverse String Difficulty: Easy 💡 Approach: • Use two pointers — one at the start, one at the end • Swap characters while moving inward • Continue until both pointers meet • Perform everything in-place (no extra space) ⚡ Performance: Runtime: 0 ms 💡 What I Learned: • Power of two-pointer technique • Writing memory-efficient (O(1)) solutions • Simplicity can still be optimal 🌿 Insight: Sometimes growth isn’t about adding more… it’s about turning things around, and seeing the same path from a wiser side. #leetcode #coding #programming #python #dsa #algorithms #strings #datastructures #problem-solving #developer #softwareengineer #100daysofcode #60daysofcode #codingjourney #competitiveprogramming #interviewprep #placements #internship #tech #computerscience #btech #aiml #studentdeveloper #dailycoding #developerlife #codingcommunity #softwaredeveloper #futureengineer #consistency #discipline #growthmindset #learncoding #codersofinstagram #techlife #grind #successmindset #explorepage #trending #stringproblems #interviewquestions #codinglife #buildinpublic #learnbydoing #codeeveryday #nevergiveup #motivation #successjourney #techcommunity
To view or add a comment, sign in
-
-
#100DaysOfLeetcode journey 🚀 🚀 Day 68/100 — Numerical Symmetry & Mirror Distances! Today’s Problem: Mirror Distance of an Integer 🔹 The Goal: Define the "Mirror Distance" of a number $n$ as the absolute difference between the number and its digit-reversal. For example, if $n = 123$, the mirror is $321$, and the distance is $|123 - 321| = 198$. 🔹 The Insight: This is a fundamental exercise in Digit Manipulation. Reversing a number isn't just a string operation; it’s an arithmetic process. By using the modulo operator (% 10) to extract the last digit and integer division (/ 10) to shift the decimal place, we can reconstruct the mirror image in a single pass. 🔹 The Logic: Arithmetic Reversal: I used a while-loop to peel off digits and build the reversed integer. This naturally handles the "omit leading zeros" rule (e.g., reversing $120$ results in $21$ because $0 \times 10 + 2 \times 1 + 1$ arithmetic logic). Absolute Variance: The final result is simply the absolute magnitude of the gap between the two values. Negative Handling: I ensured the logic remains robust for negative integers by reversing the absolute value and reapplying the sign. ✨ Achievement: Day 68! We are well into the second half of the challenge. Today’s solution highlights how core arithmetic can replace heavy string parsing for better performance and lower memory overhead. 🔍 Steps followed: ✔ Digit Extraction: Peeling digits using remainder operations. ✔ Numerical Reconstruction: Building the reversed value through decimal shifting. ✔ Error Guarding: Managed potential sign issues to ensure a valid absolute distance. 🔧 The Stats: Time Complexity: $O(\log_{10} n)$ Space Complexity: $O(1)$ 68 days down! The journey into algorithmic mastery continues. Let's keep the momentum! 🛠️ #Java #DSA #LeetCode #CodingJourney #100DaysOfCode #SoftwareEngineer #InternshipBound #Programming #MathAlgorithms #Logic #Optimization #Day68
To view or add a comment, sign in
-
-
🚀 Day 67/60 — Turning Words Around Problem Solved: Reverse Words in a String Difficulty: Medium 💡 Approach: • Split the string into words using split() • Store words in a list (ignoring extra spaces automatically) • Traverse the list in reverse order • Join them back with a single space ⚡ Performance: Runtime: 3 ms 💡 What I Learned: • Handling strings with irregular spaces • Importance of clean formatting in outputs • Reverse traversal logic in a practical scenario 🌿 Insight: Life, like a sentence, often feels scattered… but when you rearrange it with clarity, even chaos begins to make sense. #leetcode #coding #programming #python #dsa #algorithms #strings #datastructures #problem-solving #developer #softwareengineer #100daysofcode #60daysofcode #codingjourney #competitiveprogramming #interviewprep #placements #internship #tech #computerscience #btech #aiml #studentdeveloper #dailycoding #developerlife #codingcommunity #softwaredeveloper #futureengineer #consistency #discipline #growthmindset #learncoding #codersofinstagram #techlife #grind #successmindset #explorepage #trending #stringproblems #interviewquestions #codinglife #buildinpublic #learnbydoing #codeeveryday #nevergiveup #motivation #successjourney #techcommunity
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