Python O(N^2) Simple DP Solution
\nclass Solution:\n    def numTeams(self, ratings: List[int]) -> int:\n        upper_dps = [0 for _ in range(len(ratings))]\n        lower_dps = [0 for _ in ran
```\nclass Solution:\n    def numTeams(self, ratings: List[int]) -> int:\n        upper_dps = [0 for _ in range(len(ratings))]\n        lower_dps = [0 for _ in range(len(ratings))]\n        \n        count = 0\n        for i in range(len(ratings)):\n            for j in range(i):\n                if ratings[j] < ratings[i]:\n                    count += upper_dps[j]\n                    upper_dps[i] += 1\n                else:\n                    count += lower_dps[j]\n                    lower_dps[i] += 1\n                    \n        return count\n```
['Dynamic Programming', 'Python']