Company: Agoda_16nov
Difficulty: medium
Merge Palindromes Problem Description You are given two strings, s1 and s2, consisting of lowercase English letters. The goal is to identify all possible palindromes that can be formed using the letters from each string independently. From these sets, you must select one palindrome from s1 and one from s2. When the letters of these two selected palindromes are combined and possibly rearranged, they should form the longest possible single palindrome. If there are multiple palindromes of the maximum length that can be formed, return the alphabetically smallest one. Examples Example 1: Input: s1 = "aabbc", s2 = "ddefefq" Output: "abdefcfedba" Explanation: From s1, we can form palindromes using all letters: ["abcba", "bacab"] From s2, we can form palindromes using all letters: ["defqfed", "dfeqefd", "edqfde", "efdqdfe", "fdeqedf", "fedqdef"] To form the combined palindrome: Choose "abcba" from s1 and "defqfed" from s2 (alphabetically smallest options). To form a single palindrome, either '