[C++/JAVA/PYTHON] O(1) Space || Easy to Understand || With Explanation
Time complexity : O(n^2)\n- Space complexity : O(1)\n# C++ Code\n\nclass Solution {\npublic:\n    int maximumNumberOfStringPairs(vector<string>& v) {\n        i
- Time complexity : O(n^2)\n- Space complexity : O(1)\n# C++ Code\n```\nclass Solution {\npublic:\n    int maximumNumberOfStringPairs(vector<string>& v) {\n        int ans = 0; // Initialize the variable to store the answer\n        int n = v.size(); \n\n        // Iterate over all pairs of strings\n        for (int i = 0; i < n; i++) {\n            for (int j = i + 1; j < n; j++) {\n\n                // Check if i-th string is eaqual to reverse of j-th string\n                if (v[i][0] == v[j][1] && v[i][1] == v[j][0]) {\n                    ans++; // Increment the count of matching pairs\n                }\n            }\n        }\n\n        return ans; // Return the total number of matching pairs\n    }\n};\n\n```\n# Phython Code\n```\nclass Solution:\n    def maximumNumberOfStringPairs(self, word: List[str]) -> int:\n        ans = 0\n        n = len(word)\n        for i in range(n):\n            for j in range(i+1, n):\n                if word[i][0] == word[j][1] and word[i][1] == word[j][0]:\n                    ans += 1\n        return ans\n```\n# JAVA Code \n```\nclass Solution {\n    public int maximumNumberOfStringPairs(String[] words) {\n        int ans = 0;\n        int n = words.length;\n        for (int i = 0; i < n; i++) {\n            for (int j = i + 1; j < n; j++) {\n                if (words[i].charAt(0) == words[j].charAt(1) && words[i].charAt(1) == words[j].charAt(0)) {\n                    ans++;\n                }\n            }\n        }\n        return ans;\n    }\n}\n```
['C++']