1996. The Number of Weak Characters in the Game
On This Page
class Solution:
def numberOfWeakCharacters(self, properties: List[List[int]]) -> int:
properties.sort(key=lambda x: (-x[0], x[1]))
res = mx = 0
for _, x in properties:
res += x < mx
mx = max(mx, x)
return res