Practice Find the Number of Ways to Place People II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Find the Number of Ways to Place People II
Problem Statement
Each coordinate in points contains one person. Choose distinct points for Alice and Bob so that Alice is at the upper-left corner and Bob at the lower-right corner of their axis-aligned rectangle. Here larger x means right and larger y means up. The rectangle may have zero width or height and become a line. Count the choices for which no other point lies inside or on the boundary of that rectangle or line.
Source: Find the Number of Ways to Place People II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
points = [[1,1],[2,2],[3,3]]
0
# Example 2
points = [[6,2],[4,4],[2,6]]
2
# Example 3
points = [[3,1],[1,3],[1,1]]
2
Constraints
Related LeetCode Problems
Practice more problems similar to Find the Number of Ways to Place People II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.