mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
19 lines
964 B
HTML
19 lines
964 B
HTML
<p>Given a two-dimensional graph with points on it, find a line which passes the most number of points.</p>
|
|
|
|
|
|
|
|
<p>Assume all the points that passed by the line are stored in list <code>S</code> sorted by their number. You need to return <code>[S[0], S[1]]</code>, that is , two points that have smallest number. If there are more than one line that passes the most number of points, choose the one that has the smallest <code>S[0].</code> If there are more that one line that has the same <code>S[0]</code>, choose the one that has smallest <code>S[1]</code>.</p>
|
|
|
|
|
|
|
|
<p><strong>Example: </strong></p>
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
<strong>Input: </strong> [[0,0],[1,1],[1,0],[2,0]]
|
|
|
|
<strong>Output: </strong> [0,2]
|
|
|
|
<strong>Explanation: </strong> The numbers of points passed by the line are [0,2,3].
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p><strong>Note: </strong></p>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li><code>2 <= len(Points) <= 300</code></li>
|
|
|
|
<li><code>len(Points[i]) = 2</code></li>
|
|
|
|
</ul>
|
|
|