🚀 DSA Journey: 15/75 Completed 📌 Problem: Maximum Number of Vowels in a Substring of Given Length Today’s problem was a great example of the Sliding Window technique. 🔍 Key Idea: Instead of checking every substring (which is inefficient), we maintain a window of size k and: Add the next character to the window Remove the previous character Track the maximum number of vowels 💡 This reduces time complexity to O(n) — much better than brute force! 🧠 What I Learned: How to efficiently manage a fixed-size window Importance of updating values while sliding Avoiding unnecessary recalculations 🔥 Progress: 15 / 75 problems done — consistency is the real key! #DSA #CodingJourney #Java #LeetCode #100DaysOfCode #ProblemSolving
DSA Journey: Sliding Window Technique for Maximum Vowels
More Relevant Posts
-
DSA Practice Update Today I solved: #876 – Middle of the Linked List Learned how to efficiently find the middle node of a linked list using the fast and slow pointer approach. Understood how moving one pointer twice as fast as the other helps identify the middle element in a single traversal. Key Learnings: • Fast and slow pointer technique • Efficient traversal of linked lists • Solving problems in O(n) time with constant space This problem strengthened my understanding of pointer-based techniques, which are very useful in linked list problems. Continuing to stay consistent and improve problem-solving skills step by step. #DSA #LeetCode #CodingJourney #Java #SoftwareDevelopment #PlacementPreparation
To view or add a comment, sign in
-
-
Day 84 of My DSA Journey Today’s problem: Counting Bits Given a number n, the task is to return an array where each index i contains the number of 1’s in the binary representation of i. 🔍 Example: Input: n = 5 Output: [0, 1, 1, 2, 1, 2] 💡 Key Insight: Instead of counting bits every time, we reuse previous results: i >> 1 → removes last bit i & 1 → checks if last bit is 1 So, 👉 ans[i] = ans[i >> 1] + (i & 1) ⚡ This reduces time complexity to O(n) (single pass!) 📈 What I learned today: Dynamic Programming can simplify repeated computations Bit manipulation makes problems faster and cleaner Small patterns can lead to big optimizations #Day84 #DSA #Java #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 𝐃𝐚𝐲 93/100 ✅ 𝐏𝐫𝐨𝐛𝐥𝐞𝐦: 𝐋𝐨𝐧𝐠𝐞𝐬𝐭 𝐂𝐨𝐧𝐭𝐢𝐧𝐮𝐨𝐮𝐬 𝐈𝐧𝐜𝐫𝐞𝐚𝐬𝐢𝐧𝐠 𝐒𝐮𝐛𝐬𝐞𝐪𝐮𝐞𝐧𝐜𝐞 Today’s problem focused on finding the length of the longest continuous increasing subarray. Unlike LIS, this must be strictly increasing AND contiguous. 💡 𝐊𝐞𝐲 𝐋𝐞𝐚𝐫𝐧𝐢𝐧𝐠𝐬: Use a simple linear scan Maintain two variables: curr and maxLen Reset streak when order breaks Time Complexity: O(n), Space: O(1) 𝐀𝐩𝐩𝐫𝐨𝐚𝐜𝐡: Traverse the array and compare each element with the previous one: If increasing → extend streak Else → reset streak Keep updating maximum length #Day93 #100DaysOfCode #LeetCode #Java #DSA #CodingJourney #ProblemSolving #KeepLearning
To view or add a comment, sign in
-
-
Day 33/50 🚀 — Valid Palindrome (Two Pointer Approach) Today’s problem was a great mix of string manipulation + two pointers. 🔹 Ignored non-alphanumeric characters 🔹 Handled case-insensitivity 🔹 Compared characters from both ends efficiently Key insight: Instead of preprocessing the string, we can optimize in-place using two pointers, skipping unwanted characters on the go. 💡 This improves both readability and performance. Performance: ⚡ Runtime: 2 ms (99%+) 📦 Memory: Efficient #Day33 #LeetCode #TwoPointers #DSA #Java #CodingJourney #50DaysOfCode #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 13 – DSA Practice Today I explored the Sliding Window technique using the problem: Maximum Sum Subarray of Size K 📌 Problem: Given an array and a window size k, find the maximum sum of any subarray of size k. 💡 Approach: Instead of recalculating sum every time, maintain a window sum: • Add next element • Remove previous element This helps process the array in a single pass ⏱ Time Complexity: O(n) 📦 Space Complexity: O(1) This problem helped me understand how sliding window optimizes subarray problems efficiently. #Java #DSA #SlidingWindow #CodingInterview #ProblemSolving
To view or add a comment, sign in
-
-
-----Continuing my DSA journey---- * Problem: Restore The Array (1416) * Approach: -I solved this using Dynamic Programming. -I used a DP array where dp[i] represents the number of ways to form valid arrays starting from index i. For each position: • I built numbers digit by digit • Checked if the number is within the limit k • Added valid possibilities using previously computed results * Key Insight: The tricky part was handling large numbers and avoiding leading zeros. Breaking early when the number exceeds k helps optimize the solution. * What I Learned: This problem improved my understanding of DP on strings. #LeetCode #DSA #Java #DynamicProgramming #Strings #ProblemSolving
To view or add a comment, sign in
-
-
DSA Practice Update Today I solved: #141 – Linked List Cycle Learned how to detect a cycle in a linked list using Floyd’s Cycle Detection Algorithm (fast and slow pointers). Understood how moving pointers at different speeds helps identify if a loop exists without using extra space. Key Learnings: • Fast and slow pointer technique • Detecting cycles efficiently in O(n) time • Solving problems with constant space complexity This problem strengthened my understanding of pointer-based approaches, which are commonly used in linked list interview questions. Continuing to stay consistent and improve problem-solving skills step by step. #DSA #LeetCode #CodingJourney #Java #SoftwareDevelopment #PlacementPreparation
To view or add a comment, sign in
-
-
“Most people try to overcomplicate this one… but the simplest approach wins.” Day 69 — LeetCode Progress Problem: Height Checker Required: Given an array of student heights, return the number of indices where the heights are not in the expected non-decreasing order. Idea: If we sort the array, we get the expected order. Now just compare the original array with the sorted version — mismatches are the answer. Approach: Create a copy of the original array Sort the copied array Traverse both arrays: Compare elements at each index If they differ → increment count Return the count Time Complexity: O(n log n) Space Complexity: O(n) #LeetCode #DSA #Java #Arrays #Sorting #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
-
Day 37 of showing up consistently 💻🔥 Solved Arithmetic Subarrays — a problem that really sharpened my understanding of subarrays and sequence patterns. 💡 Insight: Instead of checking order directly, sorting the subarray and verifying a constant difference makes the solution clean and efficient. ⚡ Runtime: 4 ms (100% 💯) 📊 Small optimizations → Big impact Every day = 1 step closer to mastery. #Day37 #LeetCode #DSA #Java #CodingJourney #Consistency #KeepGrinding
To view or add a comment, sign in
-
-
Today I solved: Valid Palindrome 💡 Key Takeaway: The challenge was not just checking a palindrome, but handling edge cases like ignoring non-alphanumeric characters and case sensitivity. 👉 Approach: - Use two pointers (left & right) - Skip non-alphanumeric characters - Compare characters in lowercase 📊 Time Complexity: O(n) 🔍 What I learned: Problems that look simple often test attention to detail. Handling edge cases correctly is what makes a solution robust. Clean logic + edge case handling = strong solution 💪 #DSA #LeetCode #Java #CodingJourney #SoftwareEngineering
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