MILKBASKET | On-Campus OA (2022) | Find First Palindromic String in the Array
Question · Posted Jun 2026
Problem Statement Given an array of strings words, return the first palindromic string present in the array. A string is called a palindrome if it reads the same forward and backward. If no palindromic string exists, return an empty string "". Example Input words = ["abc","car","ada","racecar","cool"] Output "ada" Explanation "abc" → Not a palindrome "car" → Not a palindrome "ada" → Palindrome Since "ada" is the first palindrome encountered, return "ada". Constraints 1 <= words.length <= 100 1 <= words[i].length ...
The full answer & interview discussion are available to premium members.
Log in Create a free account