Answer: MILKBASKET | On-Campus OA (2022) | Find First Palindromic String in the Array
Answer · Posted Jun 2026
Approach Traverse each string in the array and check whether it is a palindrome using the two-pointer technique. For every word: Start one pointer from the beginning. Start another pointer from the end. Compare characters while moving inward. If all characters match, the word is a palindrome. Return the first palindrome found. Strategy Iterate through all strings. For each string: Compare left and right characters. If mismatch occurs, move to the next word. Return the first palindrome. If none exist, ...
The full answer & interview discussion are available to premium members.
Log in Create a free account