C++ || Comments Code || 4ms || 99.2 % Faster || Comments
Credits : Anonymous_Kumar\nRemember we have to do for ij>k\n\nclass Solution {\npublic:\n    int numTeams(vector<int>& arr) {\n        int n = arr.size();\n    
Credits : Anonymous_Kumar\nRemember we have to do for i<j<k ; i>j>k\n```\nclass Solution {\npublic:\n    int numTeams(vector<int>& arr) {\n        int n = arr.size();\n        int result = 0;\n        for(int i = 1 ; i < n-1 ; i++){\n            int leftSmall = 0, leftLarge = 0;\n            int rightSmall = 0, rightLarge = 0;\n            //left part\n            for(int j = 0 ; j < i ; j++){\n                if(arr[j] < arr[i]){\n                    leftSmall++;\n                }\n                if(arr[j] > arr[i]){\n                    leftLarge++;\n                }\n            }\n            //right part\n            for(int j = i+1 ; j < n ; j++){\n                if(arr[j] < arr[i]){\n                    rightSmall++;\n                }\n                if(arr[j] > arr[i]){\n                    rightLarge++;\n                }\n            }\n            \n            result += leftSmall * rightLarge + leftLarge * rightSmall;\n            //Part 1 of above equation for no.of pairs possible when i<j<k with mid element as arr[i]\n            //Part 2 of above equation for no.of pairs possible when i>j>k with mid element as arr[i]\n        }\n        return result;\n    }\n};\n```
['C']