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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Sorting problems