Medium · Sorting

The Number of Weak Characters in the Game

Given an array properties where properties[i] = [attack, defense] describes a game character, return the number of weak characters — characters for which some other character has both strictly greater attack and strictly greater defense.

Examples

Example 1

[[1,5],[10,4],[4,3]]

Output: 1 weak

Example 2

[[2,2],[3,3]]

Output: 1 weak

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Sorting problems