Day 25 of my 365 Days LeetCode Challenge 🚀
Today’s problem focuses on the Two Pointer approach to efficiently check whether a string is a palindrome.
🔹 Problem:
Given an array of strings, return the first palindromic string. If no palindrome exists, return an empty string.
🔹 Approach:
• Iterate through each word
• Use two pointers (left & right) to compare characters
• If both match until the middle → palindrome
• Return the first match immediately
🔹 Complexity:
Time → O(n × m)
Space → O(1)
Simple logic, clean implementation, and great practice for string manipulation!
#LeetCode #Day25 #365DaysCoding #TwoPointers #Java #DSA #ProblemSolving #CodeWithAbi