Click4Ai

323.

Medium

Convex Hull

**Problem Statement:** Given a set of points, find the convex hull of the points. The convex hull is the smallest convex polygon that contains all the points.

Example:

Suppose we have a set of points represented as a 2D array:

points = np.array([[0, 0], [0, 2], [2, 2], [2, 0]])

The convex hull of these points is a square with vertices at (0, 0), (0, 2), (2, 2), and (2, 0).

**Constraints:** The input points are a 2D array of (x, y) coordinates.

**Solution:** Write a function to find the convex hull of the given points.

Test Cases

Test Case 1
Input: [[0, 0], [0, 2], [2, 2], [2, 0]]
Expected: [[0 0] [0 2] [2 2] [2 0]]
Test Case 2
Input: [[0, 0], [1, 1], [2, 2], [3, 3]]
Expected: [[0 0] [2 2] [3 3] [0 3]]
+ 3 hidden test cases