Company: Mathworks IIT Bhubaneswar
Difficulty: medium
Palindromic Strings Problem Description A palindrome reads the same forwards and backwards, e.g., "mom", "a", or "radar". You are given an array of n strings consisting of lowercase English letters. In one operation, you can swap any two letters from any two distinct strings in the array. Determine the maximum number of palindromic strings that can be obtained by performing any number of these operations. In other words, choose 4 integers, x, y, i, j such that 1 ≤ x ≤ n, 1 ≤ i ≤ length(arr[x]), 1 ≤ j ≤ length(arr[y]) and swap arr[x][i] and arr[y][j] using 1-based indexing. Complete the function countPalindromes in the editor with the following parameters: string arr[n] : the strings to consider Returns: int : the maximum number of palindromic strings possible Examples Example 1: Input: n = 4 arr = ["pass", "sas", "asps", "dl"] Explanation: An optimal solution produces 3 palindromes: Select x = 1, y = 3, i = 3, j = 1, swap (arr[1][3], arr[3][1]) Result: arr = ["paas",