当前位置:网站首页>Force buckle 1232 Dotted line
Force buckle 1232 Dotted line
2022-07-07 20:06:00 【Tomorrowave】
1232. Dotted line
Given an array coordinates , among coordinates[i] = [x, y] , [x, y] The abscissa is x、 Ordinate for y The point of . Please judge , Whether these points belong to the same line in the coordinate system .
Example 1:
Input :coordinates = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]]
Output :true
Ideas
Use the product of slope to do
Code section
class Solution:
def checkStraightLine(self, coordinates: List[List[int]]) -> bool:
a=coordinates[1][0]-coordinates[0][0]
b=coordinates[1][1]-coordinates[0][1]
for i in range(2,len(coordinates)):
c = coordinates[i][0] - coordinates[0][0]
d = coordinates[i][1] - coordinates[0][1]
if (a * d - b * c != 0):
return False
return True
边栏推荐
- 831. KMP string
- 一文读懂数仓中的pg_stat
- Time tools
- 力扣 643. 子数组最大平均数 I
- CUDA versions are inconsistent, and errors are reported when compiling apex
- pom.xml 配置文件标签作用简述
- [confluence] JVM memory adjustment
- IP tools
- Make this crmeb single merchant wechat mall system popular, so easy to use!
- How to buy stocks on your mobile phone and open an account? Is it safe to open an account
猜你喜欢

MRS离线数据分析:通过Flink作业处理OBS数据
让这个 CRMEB 单商户微信商城系统火起来,太好用了!

多个线程之间如何协同

Chapter 9 Yunji datacanvas was rated as 36 krypton "the hard core technology enterprise most concerned by investors"

mock. JS returns an array from the optional data in the object array

Sword finger offer II 013 Sum of two-dimensional submatrix

华南X99平台打鸡血教程

位运算介绍

PMP对工作有益吗?怎么选择靠谱平台让备考更省心省力!!!

Simulate the implementation of string class
随机推荐
My creation anniversary
干货分享|DevExpress v22.1原版帮助文档下载集合
Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记
吞吐量Throughout
Data island is the first danger encountered by enterprises in their digital transformation
Is PMP beneficial to work? How to choose a reliable platform to make it easier to prepare for the exam!!!
tp6 实现佣金排行榜
强化学习-学习笔记8 | Q-learning
九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
831. KMP字符串
让这个 CRMEB 单商户微信商城系统火起来,太好用了!
IP 工具类
[sword finger offer] sword finger offer II 012 The sum of left and right subarrays is equal
pom.xml 配置文件标签:dependencies 和 dependencyManagement 区别
el-upload上传组件的动态添加;el-upload动态上传文件;el-upload区分文件是哪个组件上传的。
Detailed explanation of Flink parallelism and slot
R语言fpc包的dbscan函数对数据进行密度聚类分析、查看所有样本的聚类标签、table函数计算聚类簇标签与实际标签构成的二维列联表
MRS离线数据分析:通过Flink作业处理OBS数据
vulnhub之Funfox2
R语言ggplot2可视化:使用ggpubr包的ggqqplot函数可视化QQ图(Quantile-Quantile plot)