Java || Simple || O(n2) Easy to understand
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:  O(n2)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int numTeams(int[] rating) {\n        int n=rating.length;\n\n        int nge[]=new int[n];\n        int nse[]=new int[n];\n\n        for(int i=0;i<n;i++){\n            for(int j=i+1;j<n;j++){\n                if(rating[i]<rating[j]){\n                    nge[i]++;\n                }\n                else nse[i]++;\n            }\n        }\n        int cnt=0;\n        for(int i=0;i<n;i++){\n            for(int j=i+1;j<n;j++){\n                if(rating[i]<rating[j]){\n                    cnt+=nge[j];\n                }\n                else cnt+=nse[j];\n            }\n        }\n        return cnt;\n    }\n}\n```
['Array', 'Java']