Search
⌘K

Leetcode 2280. Minimum Lines to Represent a Line Chart

Given points (day, price), find the minimum number of straight line segments needed to draw the polyline connecting points in increasing day order — equivalently, after sorting by day, count how many times the slope between consecutive points changes. Note n can be up to 1e5 and coordinates large, so detect collinearity by exact slope comparison (e.g., cross product) rather than floating-point.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.