Java Solution with Explanation
Intuition\nRecursion to get all possible subsequence for consideration\nSimilar working as- all_possible_subsequence_of_string_problem\n\n# Approach\n1) conside
# Intuition\nRecursion to get all possible subsequence for consideration\nSimilar working as- [all_possible_subsequence_of_string_problem](https://takeuforward.org/data-structure/power-set-print-all-the-possible-subsequences-of-the-string/)\n\n# Approach\n1) consider current char for S1\n2) consider current char for S2\n3) Don\'t consider current char for either\n\nNote- current char cannot be inclue in both at the same time\n\n# Complexity\n- Time complexity:\nO(3^n)\n\n- Space complexity:\nO(n) where n is char array\n\n# Code\n```java []\nclass Solution {\n    int res = 0;\n    \n    public int maxProduct(String s) {\n        char[] strArr = s.toCharArray();\n        dfs(strArr, 0, "", "");\n        return res;\n    }\n\n    public void dfs(char[] strArr, int i, String s1, String s2){\n        if(i >= strArr.length){\n            if(isPalindromic(s1) && isPalindromic(s2))\n                res = Math.max(res, s1.length()*s2.length());\n            return;\n        }\n        dfs(strArr, i+1, s1 + strArr[i], s2);\n        dfs(strArr, i+1, s1, s2 + strArr[i]);\n        dfs(strArr, i+1, s1, s2);\n    }\n\n    public boolean isPalindromic(String str){\n        int j = str.length() - 1;\n        char[] strArr = str.toCharArray();\n        for (int i = 0; i < j; i ++){\n            if (strArr[i] != strArr[j])\n                return false;\n            j--;\n        }\n        return true;\n    }\n}\n```
['Recursion', 'Java']