Convex hull · monotone chain
Imagine a rubber band stretched around all the points. Find the points where it changes direction.
Keep left turns while building each side. For a right turn or three collinear points, remove the last point and test again.
Drag points on the grid. Use + and − to add or remove a point, or select its letter to edit its coordinates.
Sorting takes O(n log n). On each pass a point is pushed once and popped at most once. Extra space is O(n).