🚀 Day 47 of DSA Problem: Longest Palindromic Substring A palindrome reads the same forward and backward. The challenge was to find the longest such substring inside a given string. 💡 Key Idea: Expand around each character (center) and check both odd and even length palindromes. ⏱ Time Complexity: O(n²) 💾 Space Complexity: O(1) This problem reinforced how choosing the right approach can drastically reduce complexity compared to brute force solutions. Consistent practice is sharpening my problem-solving skills step by step. 💪 #DSA #Java #CodingPractice #LeetCode #Programming #ProblemSolving
Longest Palindromic Substring Challenge
More Relevant Posts
-
Day 31 - Examination methods in Deque 1) getFirst( ) : Retrieves, but what doesn't remove the first element. 2) getLast( ) : Retrieves, but does not remove the last element 3) peekFirst( ) : Retrieves, but does not remove the first element or return if empty null if empty. 4) peekLast( ) : Retrieves, but does not remove the last element or returns nullif empty. ● Stack methods: 1) push( ) : Adds an element at the first. 2) pop ( ) : Removes and returns the first element. #Java #Programming #coding #learning #Corejava EchoBrains
To view or add a comment, sign in
-
-
Solved a Gray Code problem in C++ today. The task was to generate bit patterns from 0 to 2^n - 1 such that every consecutive pattern differs by only one bit, while always starting from 0. I used the Gray code formula: gray = i ^ (i >> 1) This makes the solution clean and efficient, and guarantees that adjacent codes differ by exactly one bit. Example for n = 2: 00 -> 01 -> 11 -> 10 What I like about this problem is how a simple bit manipulation formula can solve what looks like a complex sequence-generation challenge. Concepts practiced: Bit Manipulation Binary Representation Pattern Generation C++ Problem Solving #cpp #coding #programming #datastructures #algorithms #problemsolving #bitmanipulation #leetcode #geekforgeeks
To view or add a comment, sign in
-
-
#Day56 solved LeetCode 169 Majority Element Problem: Find the element that appears more than ⌊n/2⌋ times in an array. Approach: Instead of using extra space like HashMap, I learned a very efficient method called the Boyer-Moore Voting Algorithm. The idea is simple: 1.Keep a candidate and a count 2.Increase count if same element appears 3.Decrease count if different element appears 4.The final candidate will be the majority element Time Complexity: O(n) Space Complexity: O(1) This problem taught me how powerful optimized logic can be compared to brute force solutions. #DSA #LeetCode #Coding #ProblemSolving #100DaysOfCode #Programmer #LearningJourney
To view or add a comment, sign in
-
-
🚀 Day 123/500 – LeetCode DSA Challenge Today I solved three problems covering strings and matrix manipulation. ✅ Valid Palindrome – Used two pointers while ignoring non-alphanumeric characters. TC: O(n) | SC: O(1) ✅ Determine Matrix Rotation – Rotated matrix up to 4 times and compared with target. TC: O(n²) | SC: O(n²) ✅ Reverse Submatrix – Reversed rows within a submatrix using two-pointer technique. TC: O(k²) | SC: O(1) 💡 Key Learning: Two-pointer approach works well in both strings and matrices, and matrix problems often involve rotation or transformation patterns. 👉 Day 122/500 #DSA #Java #500DaysChallenge #ProblemSolving #CodingJourney
To view or add a comment, sign in
-
📘 DSA Journey — Day 20 Today’s focus: Sliding Window with frequency constraints. Problem solved: • Maximum Number of Occurrences of a Substring (LeetCode 1297) Concepts used: • Sliding Window technique • Frequency tracking using HashMap / array • Substring counting Key takeaway: The goal is to find the maximum frequency of any substring that satisfies: • At most maxLetters distinct characters • Length between minSize and maxSize A key observation simplifies the problem: We only need to check substrings of size minSize, because larger substrings will have equal or lower frequency. Using a sliding window of fixed size minSize, we: • Track character frequencies inside the window • Ensure the number of distinct characters ≤ maxLetters • Count valid substrings using a HashMap This avoids checking all possible substring sizes and reduces complexity significantly. This problem highlights how constraints can reduce the search space, making sliding window solutions more efficient. Continuing to strengthen pattern recognition and consistency in solving DSA problems. #DSA #Java #LeetCode #CodingJourney
To view or add a comment, sign in
-
-
Day 54 of Practicing DSA (LeetCode && Competitive Programming) Today’s progress: LeetCode • Maximum Product Subarray – Medium Focused on: • Understanding Kadane’s Algorithm variation • Tracking both maximum and minimum product (due to negative numbers) • Handling sign changes effectively • Improving intuition for dynamic programming in arrays This problem deepened my understanding of how negative values impact subarray problems. Competitive Programming • Continued practicing problem-solving patterns Improved my thinking on: • Handling edge cases in array-based problems • Writing optimized solutions with better logic clarity Daily progress may look small, but it’s building strong fundamentals 💪 Consistency is the real game 🔥 #DSA #Java #LeetCode #Codeforces #DynamicProgramming #Arrays #ProblemSolving #Consistency #Learnin
To view or add a comment, sign in
-
-
Day 4 — Pattern-Based DSA Practice Continuing to learn and build in public while solving problems pattern by pattern. Today's focus: Binary Search on Rotated Arrays & Peaks Problems solved: • Count Occurrences — Coding Ninjas • Minimum Element in Rotated Sorted Array — LeetCode • Number of Times Array is Rotated — CodeChef • Find Peak Element — LeetCode Key learning: Binary Search is not always applied on perfectly sorted arrays. It can also be extended to rotated arrays and peak-based problems by carefully analyzing conditions. Instead of searching for a target, many problems are about identifying the correct region where the answer lies. Slowly understanding how the same pattern adapts to different scenarios with slight logical changes. #DSA #BinarySearch #ProblemSolving #LearningInPublic #Java #CodingJourney
To view or add a comment, sign in
-
Day 12 of Consistency 🚀 Today I focused on understanding Time and Space Complexity, which is a fundamental concept in Data Structures and Algorithms. Learned how to analyze the efficiency of an algorithm and why optimizing code is important as input size grows. Understanding complexity helps in writing better and more efficient solutions. Step by step improving my problem-solving mindset. 💻📚 #Day12 #DSA #TimeComplexity #Java #Programming #CodingJourney #LearningInPublic
To view or add a comment, sign in
-
-
🚀 Mastering C++ & DSA 💻🔥 Strong foundation. Sharp logic. Clean code. From understanding pointers & memory management to solving complex Data Structures & Algorithms, I’m building a powerful problem-solving mindset with C++. 📌 What I’m focusing on: ✔️ OOP Concepts (Encapsulation, Inheritance, Polymorphism) ✔️ STL (Vectors, Maps, Sets) ✔️ DSA (Arrays, Linked List, Stack, Queue, Trees, Graphs) ✔️ Problem Solving & Optimization ✔️ Competitive Coding Mindset 💡 C++ is not just a language, it's a tool to think, optimize, and solve real-world problems efficiently. 🔥 Goal: Crack top tech interviews & build scalable systems. #CPlusPlus #DSA #Programming #SoftwareDevelopment #ProblemSolving #CodingJourney #TechSkills #DeveloperLife
To view or add a comment, sign in
-
-
42 of #100DaysOfCode Solved LeetCode 930 – Binary Subarrays With Sum 💡 Today’s problem was a great example of how powerful Prefix Sum + HashMap can be when dealing with subarrays. 🔹 Approach Used: Instead of checking all subarrays (which would be inefficient), I used a running prefix sum and stored its frequency in a hashmap. This reduces the time complexity to O(n) — much more efficient than brute force! ⚡ 🔹 What I Learned: Prefix sum helps convert subarray problems into lookup problems HashMap optimizes repeated computations Always think: “Can I store previous results to save time?” #LeetCode #DSA #CodingJourney #Programming #Cpp #SoftwareEngineering #ProblemSolving #LearnToCode
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