Tap here to switch tabs
Problem
Submissions

Problem: The Number of Weak Characters in the Game

med
30 min
Try to solve the The Number of Weak Characters in the Game problem.

Statement

You are playing a game with multiple characters. You are given a 2extD2 ext{D} integer array properties where properties[i] =[extattacki,extdefensei]= [ ext{attack}_i, ext{defense}_i] represents the attack and defense values of the iextthi ext{th} character.

A character is considered weak if there exists another character that has both strictly greater attack and strictly greater defense.

Return the total number of weak characters.

Constraints:

  • 2≤2 \leq properties.length ≤105\leq 10^5

  • properties[i].length =2= 2

  • 1≤extattacki,extdefensei≤1051 \leq ext{attack}_i, ext{defense}_i \leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: The Number of Weak Characters in the Game

med
30 min
Try to solve the The Number of Weak Characters in the Game problem.

Statement

You are playing a game with multiple characters. You are given a 2extD2 ext{D} integer array properties where properties[i] =[extattacki,extdefensei]= [ ext{attack}_i, ext{defense}_i] represents the attack and defense values of the iextthi ext{th} character.

A character is considered weak if there exists another character that has both strictly greater attack and strictly greater defense.

Return the total number of weak characters.

Constraints:

  • 2≤2 \leq properties.length ≤105\leq 10^5

  • properties[i].length =2= 2

  • 1≤extattacki,extdefensei≤1051 \leq ext{attack}_i, ext{defense}_i \leq 10^5