|
| 1 | +<h2><a href="https://leetcode.com/problems/check-if-it-is-a-straight-line">Check If It Is a Straight Line</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>You are given an array <code>coordinates</code>, <code>coordinates[i] = [x, y]</code>, where <code>[x, y]</code> represents the coordinate of a point. Check if these points make a straight line in the XY plane.</p> |
| 2 | + |
| 3 | +<p> </p> |
| 4 | + |
| 5 | +<p> </p> |
| 6 | +<p><strong class="example">Example 1:</strong></p> |
| 7 | + |
| 8 | +<p><img alt="" src="https://assets.leetcode.com/uploads/2019/10/15/untitled-diagram-2.jpg" style="width: 336px; height: 336px;" /></p> |
| 9 | + |
| 10 | +<pre> |
| 11 | +<strong>Input:</strong> coordinates = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]] |
| 12 | +<strong>Output:</strong> true |
| 13 | +</pre> |
| 14 | + |
| 15 | +<p><strong class="example">Example 2:</strong></p> |
| 16 | + |
| 17 | +<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2019/10/09/untitled-diagram-1.jpg" style="width: 348px; height: 336px;" /></strong></p> |
| 18 | + |
| 19 | +<pre> |
| 20 | +<strong>Input:</strong> coordinates = [[1,1],[2,2],[3,4],[4,5],[5,6],[7,7]] |
| 21 | +<strong>Output:</strong> false |
| 22 | +</pre> |
| 23 | + |
| 24 | +<p> </p> |
| 25 | +<p><strong>Constraints:</strong></p> |
| 26 | + |
| 27 | +<ul> |
| 28 | + <li><code>2 <= coordinates.length <= 1000</code></li> |
| 29 | + <li><code>coordinates[i].length == 2</code></li> |
| 30 | + <li><code>-10^4 <= coordinates[i][0], coordinates[i][1] <= 10^4</code></li> |
| 31 | + <li><code>coordinates</code> contains no duplicate point.</li> |
| 32 | +</ul> |
0 commit comments