1 ms Beats 100.00% of users with Java
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: 1ms  \n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: 41.40 mb\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int maximumNumberOfStringPairs(String[] words) {\n        int count = 0;\n        for (int i = 0; i< words.length; i++){\n\n            for(int j=i+1; j<words.length; j++){\n                \n                if(words[i].charAt(0) == words[j].charAt(1) && words[i].charAt(1) == words[j].charAt(0))count++;\n            }\n        }\n        return count;\n    }\n}\n```
['Java']