Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
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.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.