Leetcode 1511 Solution
This article provides solution to leetcode question 1511 (count-number-of-teams)
Access this page by simply typing in "lcs 1511" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
class Solution: def numTeams(self, rating: List[int]) -> int: def count(rating): ans = 0 for i in range(len(rating)): down = 0 up = 0 for j in range(i): down += int(rating[i] > rating[j]) for j in range(i + 1, len(rating)): up += int(rating[i] < rating[j]) ans += down * up return ans return count(rating) + count(list(reversed(rating)))