Tap here to switch tabs
Problem
Submissions

Problem: The Number of Weak Characters in the Game

The Number of Weak Characters in the Game gives an array of attack and defense values. Count characters that another character exceeds in both attributes.

Statement

You are playing a game with multiple characters. You are given a 2D2 {D} integer array properties where properties[i] =[attacki,defensei]= [ {attack}_i, {defense}_i] represents the attack and defense values of the ithi {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≤attacki,defensei≤1051 \leq {attack}_i, {defense}_i \leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: The Number of Weak Characters in the Game

The Number of Weak Characters in the Game gives an array of attack and defense values. Count characters that another character exceeds in both attributes.

Statement

You are playing a game with multiple characters. You are given a 2D2 {D} integer array properties where properties[i] =[attacki,defensei]= [ {attack}_i, {defense}_i] represents the attack and defense values of the ithi {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≤attacki,defensei≤1051 \leq {attack}_i, {defense}_i \leq 10^5