✅ Without  Map | C++ | Easy
SInce each string contains only two letters so we can easily store this letters in a 2-D array\n\n\nclass Solution {\npublic:\n    int longestPalindrome(vector<
**SInce each string contains only two letters so we can easily store this letters in a 2-D array**\n\n```\nclass Solution {\npublic:\n    int longestPalindrome(vector<string>& words) {\n        \n       int count[26][26] = {}; \n       int ans =0;\n        \n\t\t\tfor(auto w : words){\n\t\t\t\tint a = w[0] - \'a\';\n\t\t\t\tint b = w[1] - \'a\'; \n\n\t\t\t\tif(count[b][a]){\n\t\t\t\t\tans+= 4;          \n\t\t\t\t\tcount[b][a]--;   // decrement the count as we found mirror word\n\t\t\t\t}else\n\t\t\t\t\tcount[a][b]++;  //increment the current word count if we not find any mirror word\n\t\t\t}\n        \n\t\t\tfor(int i=0;i<26;i++){\n\t\t\t\tif(count[i][i]){\n\t\t\t\t\tans+=2;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t }\n      \n\treturn ans;\n         \n    }\n};\n```\n**Time Complexity : - O(n)  , where n is the size of array words.\nSpace Complexity:- O(26*26).**\n
['Dynamic Programming', 'C']