🚀 Day 19/100 – DSA Journey Today’s focus was on string manipulation and pattern-based thinking 🔤 These problems looked simple but required careful handling of conditions 👀 🔹 Problems Solved: 1. Split a String in Balanced Strings 2. Reverse String II 💡 Key Learnings: 👉 Problem 1: Split Balanced Strings Traverse string and keep a counter Increment for 'L', decrement for 'R' (or vice versa) Whenever count becomes 0 → one balanced substring found 👉 Key Insight: Balance tracking helps split efficiently ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Reverse String II Process string in chunks of size 2k Reverse first k characters, leave next k as it is 👉 Key Insight: Careful boundary handling is crucial (edge cases matter!) ✅ O(n) Time ✅ O(1) Space (in-place logic conceptually) 🔥 What I learned today: Many string problems are about identifying the right pattern (counting / chunking) rather than complex logic. Small mistakes in conditions can break the entire solution — attention to detail is everything 👀 Day 19 done ✅ Consistency continues! 💬 Quick question: Which do you find trickier — handling edge cases or finding the right pattern? #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
String Manipulation and Pattern-Based Thinking in DSA
More Relevant Posts
-
🚀 Day 19/100 – DSA Journey Today’s focus was on string manipulation and pattern-based thinking 🔤 These problems looked simple but required careful handling of conditions 👀 🔹 Problems Solved: 1. Split a String in Balanced Strings 2. Reverse String II 💡 Key Learnings: 👉 Problem 1: Split Balanced Strings Traverse string and keep a counter Increment for 'L', decrement for 'R' (or vice versa) Whenever count becomes 0 → one balanced substring found 👉 Key Insight: Balance tracking helps split efficiently ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Reverse String II Process string in chunks of size 2k Reverse first k characters, leave next k as it is 👉 Key Insight: Careful boundary handling is crucial (edge cases matter!) ✅ O(n) Time ✅ O(1) Space (in-place logic conceptually) 🔥 What I learned today: Many string problems are about identifying the right pattern (counting / chunking) rather than complex logic. Small mistakes in conditions can break the entire solution — attention to detail is everything 👀 Day 19 done ✅ Consistency continues! 💬 Quick question: Which do you find trickier — handling edge cases or finding the right pattern? #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #frontenddeveloper #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
🚀 Day 21/100 – DSA Journey Today’s problems were all about string comparison and pattern matching 🔤 At first they looked straightforward… but handling all cases cleanly was the real challenge 👀 🔹 Problems Solved: 1. Valid Anagram 2. Longest Common Prefix 💡 Key Learnings: 👉 Problem 1: Valid Anagram Compare character frequencies of both strings If every character count matches → strings are anagrams 👉 Key Insight: Frequency counting using Map/Object makes comparison efficient ✅ O(n) Time ✅ O(1) Space (fixed alphabet size) 👉 Problem 2: Longest Common Prefix Start with the first word as prefix Compare it with remaining strings Reduce prefix until all strings match 👉 Key Insight: Gradually shrinking the prefix is simpler than generating all prefixes ✅ O(n * m) Time (m = prefix length) ✅ O(1) Extra Space 🔥 What I learned today: String problems are less about complicated algorithms and more about: choosing the right approach handling edge cases carefully writing clean logic Small optimizations and cleaner thinking are becoming more natural now ⚡ Day 21 done ✅ Still showing up every day! 💬 Quick question: Which do you prefer solving more: 🔹 String problems 🔹 Linked List problems 🔹 Array problems #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #frontenddeveloper #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
After a short break due to exams, I’m finally back on track with DSA : For the past 2–3 weeks, consistency wasn’t easy to maintain—but now I’m diving back in, starting with one of the most fundamental and powerful concepts in C++: STL (Standard Template Library). 🔹 What I learnToday: STL & Vectors: One of the most useful components of STL is the vector, which is essentially a dynamic array. Here are some key takeaways from my revision: ✅ Vector behaves like an array But unlike arrays, its size is not fixed—it grows and shrinks automatically. ✅ Dynamic Memory (Heap Allocation) Vectors store elements in dynamic memory, allowing flexible resizing without worrying about stack overflow. ✅ Size vs Capacity size() → number of elements currently present capacity() → total allocated space Interestingly, when capacity gets full, it typically doubles, and elements are copied to a new memory location. ✅ Important Operations push_back() → add element pop_back() → remove last element erase() → remove specific element (with shifting) clear() → remove all elements Example insight: When you erase an element, the next elements automatically shift left to fill the gap. 🔹 Why STL Matters STL provides ready-made, optimized tools like: Vectors Stacks Queues Maps Sets This saves time and helps focus more on problem-solving rather than implementation from scratch. 🔹 My Learning Reflection Coming back after a break reminded me that consistency > perfection. Even revisiting basics like vectors gives deeper clarity when understood properly. This is just the restart—more DSA concepts coming next #DSA #RohitNegi #CPP #STL #LearningJourney #Consistency #BackOnTrack
To view or add a comment, sign in
-
Day 53 of DSA Journey Today I learned a powerful trick to optimize a problem involving distance between equal elements. Problem Insight: For every element, we need to find the sum of distances to all other indices having the same value. Naive Approach: Store indices using a hashmap For every index → loop over all same elements Time Complexity: O(n²) -TLE Instead of calculating distances one by one: Split into left side and right side Use prefix sum to avoid repeated calculations Core Thinking: Left → distance from current index to all previous same elements Right → distance from current index to all next same elements Total = Left + Right This reduces complexity to O(n) and makes the solution scalable! Key Learning Whenever you see: “sum of distances” =>“prefix sum + contribution technique” #DSA #CodingJourney #LeetCode #Cpp #ProblemSolving #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 18 of My DSA Journey — Solving 4Sum Problem Today I tackled the 4Sum problem — an interesting extension of the classic 2Sum and 3Sum challenges. 🔍 Problem Statement: Given an array of integers, find all unique quadruplets such that their sum equals a target value. 💡 Key Learnings: Sorting plays a crucial role in optimizing solutions Reduced complexity using two-pointer technique Handling duplicates carefully is the real challenge Importance of choosing correct data types (avoiding overflow) ⚙️ Approach I Used: Sorted the array first Fixed two elements using loops Applied two-pointer technique for remaining two elements Skipped duplicates to ensure unique quadruplets ⏱️ Time Complexity: O(n³) 📌 Example: Input: [1, 0, -1, 0, -2, 2], Target = 0 Output: [-2, -1, 1, 2] [-2, 0, 0, 2] [-1, 0, 0, 1] 🔥 This problem really improved my understanding of multi-pointer strategies and edge-case handling. Consistency is the key — one problem at a time 💪 #Day18 #DSA #CodingJourney #LeetCode #ProblemSolving #CProgramming #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 16/100 – DSA Journey Today’s problem was a great exercise in pointer manipulation and recursion thinking 🔗 🔹 Problem Solved: 1. Swap Nodes in Pairs 💡 Key Learnings: 👉 Approach 1: Iterative (Pointer Manipulation) Use a dummy node to simplify edge cases Swap nodes in pairs by adjusting pointers Move pointers step by step 👉 Key Insight: Careful pointer updates are crucial — one wrong link breaks the list 👉 Approach 2: Recursive Swap first two nodes Recursively solve for the rest of the list 👉 Core Idea: Break problem into smaller subproblems ✅ O(n) Time ✅ O(1) Space (Iterative) ⚠️ Recursive uses call stack → O(n) space 🔥 What I learned today: Same problem, two different mindsets: Iterative → control everything step-by-step Recursive → trust the function to handle smaller parts Both are powerful — knowing when to use which is key 👀 Day 16 done ✅ Consistency continues! 💬 Quick question: Which approach do you prefer for Linked Lists — Iterative or Recursive? #100DaysOfDSA #buildinpublic #codinginpublic #leetcodejourney #softwareengineerlife #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
🚀 Day 4 of DSA Journey Problem: Rotate Array by 1 (Left Rotation) In my initial attempt : • Confused left rotation with right rotation • Focused on "shifting elements" instead of thinking where each value should come from • Assumed array stays unchanged during loop • Ended up overwriting values again and again • Made a small syntax mistake (= instead of ==) After taking a hint, I didn’t just fix the code — I fixed my thinking. What I understood: ● Every index should be thought as: “final value is coming from which index?” ● Array updates immediately in each iteration (no original copy exists) ● Direction of traversal matters a lot Final clarity: Left rotation → first element goes to last Right rotation → last element comes to front Slowly learning to think before coding. #DSA #Day4 #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
-
What do you do with your DSA prep when you have absolutely zero time to code? We all have those days. Work is completely exhausting. You are away from your keyboard. The thought of opening a compiler and debugging for an hour feels impossible. Here is the hack I used to keep my prep moving forward on my busiest days: The "Read-Only" Method. If you know the logic for a problem but don’t have time to code it, just read and understand as many as you can. 1. Study the constraints. 2. Guess the core pattern. (Is it Sliding Window? BFS?) 3. Look at the examples and find the "trick." 4. Check the solution to see if your mental map was right. Move on fast. Don’t get stuck perfecting code. Being able to instantly recognize the pattern is 80% of the battle. If you can mentally map out the solution, you are still making massive progress without writing a single line of code. Consistency isn't about writing code 7 days a week. It's about keeping your brain locked into the patterns. How do you keep your momentum going on days you are too tired to code?👇 #DSA #Productivity #SoftwareEngineering #LeetCode #StudentLife #TechCareers
To view or add a comment, sign in
-
-
🚀 Day 15/100 – DSA Journey Today was all about restructuring Linked Lists efficiently and thinking in terms of pointer movement 🔗 🔹 Problems Solved: 1. Rotate List 2. Merge Two Sorted Lists 💡 Key Learnings: 👉 Problem 1: Rotate List First, calculate the length of the list Optimize rotations using: k % length Use two pointers (fast & slow) to find new head 👉 Key Insight: Instead of rotating one by one, directly find the breaking point ✅ O(n) Time ✅ O(1) Space 👉 Problem 2: Merge Two Sorted Lists Used dummy node technique for clean implementation Compare nodes and attach smaller one 👉 Key Insight: Avoid extra space by reusing existing nodes ✅ O(n + m) Time ✅ O(1) Space 🔥 What I learned today: Most Linked List problems become easier when you: - Use dummy nodes - Think in terms of breaking & reconnecting links Also realized how small optimizations (like k % n) can save a lot of work 👀 Day 15 done ✅ Staying consistent! #100DaysOfDSA #buildinpublic #developersoflinkedin #codinginpublic #leetcodejourney #softwareengineerlife #dailylearning #codingpractice #devcommunity #programminglife #techcareers #jobready #growthmindset
To view or add a comment, sign in
-
💻 Day 115 — DSA Practice Update Solved 2121 — Intervals Between Identical Elements today. This was an interesting array-based problem that involved grouping indices of identical elements and efficiently calculating the sum of distances between them. It required optimizing the approach using prefix sums to avoid brute-force solutions. Problems like this help strengthen understanding of grouping techniques and efficient computation strategies. Continuing my daily DSA practice with consistency and focus on improving problem-solving skills 🚀 🔗 LeetCode Profile: https://lnkd.in/g7SJpmVA #LeetCode #DSA #Arrays #PrefixSum #ProblemSolving #LearningJourney #StudentDeveloper💻 Day 83 — DSA Practice Update Solved 2121 — Intervals Between Identical Elements today. This was an interesting array-based problem that involved grouping indices of identical elements and efficiently calculating the sum of distances between them. It required optimizing the approach using prefix sums to avoid brute-force solutions. Problems like this help strengthen understanding of grouping techniques and efficient computation strategies. Continuing my daily DSA practice with consistency and focus on improving problem-solving skills 🚀 🔗 LeetCode Profile: https://lnkd.in/g7SJpmVA #LeetCode #DSA #Arrays #PrefixSum #ProblemSolving #LearningJourney #StudentDeveloper
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