Skip to content

Practice Find the Number of Ways to Place People I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3025
LeetCode Problem

Find the Number of Ways to Place People I

Problem Statement

Given distinct points, count ordered pairs (A, B) with A at or above and at or left of B. Their axis-aligned rectangle, which may be a horizontal or vertical line, must contain no other given point inside or on its boundary. Return the count.

Source: Find the Number of Ways to Place People I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
points = [[1,1],[2,2],[3,3]]
Output
0

# Example 2

Input
points = [[6,2],[4,4],[2,6]]
Output
2

# Example 3

Input
points = [[3,1],[1,3],[1,1]]
Output
2

Constraints

2 <= n <= 50
points[i].length == 2
0 <= points[i][0], points[i][1] <= 50
All points[i] are distinct.

Related LeetCode Problems

Practice more problems similar to Find the Number of Ways to Place People I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.